47055

IntelliJ can't find my M2_HOME, why is that? [duplicate]

Question:

This question already has an answer here:

<ul><li> <a href="/questions/7053666/maven-home-m2-home-not-being-picked-up-by-intellij-idea" dir="ltr" rel="nofollow">Maven home (M2_HOME) not being picked up by IntelliJ IDEA</a> <span class="question-originals-answer-count"> 7 answers </span> </li> </ul>

When I create a new Maven project, I see an error message that says:

<blockquote>

[FATAL_ERROR] Cannot start Maven: No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system.

</blockquote>

In terminal (I'm on a Mac) if I do:

echo $M2 echo $M2_HOME

it displays the full path to my /apache-maven-3.0.3/bin and /apache-maven-3.0.3 folders.

Why would IntelliJ not be able to pick this up?

Answer1:

Environment variables set in terminal are not always visible to GUI applications:

<ul><li><a href="http://apple.stackexchange.com/q/51677" rel="nofollow">http://apple.stackexchange.com/q/51677</a></li> <li><a href="http://apple.stackexchange.com/q/57385/17551" rel="nofollow">http://apple.stackexchange.com/q/57385/17551</a></li> <li><a href="http://stackoverflow.com/q/135688/104891" rel="nofollow">http://stackoverflow.com/q/135688/104891</a></li> </ul>

Answer2:

Are you on a Linux-type system?

Is the M2_HOME variable only set when <em>you</em> start a <em>terminal</em> session? (e.g. in a .bashrc or equivalent script) ?

Try starting the IDE from the command line and see if that helps.

You might just need to set that variable on a system-wide basis as the shortcut you use to start IntelliJ might not pick up your local environment vars.

Recommend

  • Xcode duplicated devices bug
  • CUDA NSight is not installed with CUDA 5.0 installation file on Windows 8? [closed]
  • Returning this from a constructor function in JS
  • dismiss Progress Dialog in another Activity … Android
  • How to remove all of a jQuery UI dialog when it is closed
  • Add Windows Feature from C#
  • What is the use of a session store?
  • How to skip require in ruby?
  • Yii2: Finding file and getting path in a directory tree
  • Is there some graphical way to create my own configuration file on SonarLint?
  • Saving image to sd with current date and time in name doesn't work
  • Web.config system.webserver errors
  • Spring Cloud Microservice Architecture Confusion
  • zope_i18n_compile_mo_files doesn't work on a Zeo configuration
  • Visual Studio 2010 debugger build correctly - compiler pdb and linker pdb not in synch?
  • How to suppress a dialog
  • Yii2: Config params vs. const/define
  • Checking free space on FTP server
  • Alert pop up with LWUIT
  • Change Inet root folder for iis 7
  • How can I send an e-mail from a vbs script
  • Validaiting emails with Net.Mail MailAddress
  • htaccess rewriting URLs with multiple forward slashes
  • Updated Ionic CLI but shows previous version (Windows)
  • Weird JavaScript statement, what does it mean?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Adding custom controls to a full screen movie
  • How do you troubleshoot character encoding problems?
  • 0x202A in filename: Why?
  • Is there a mandatory requirement to switch app.yaml?
  • How to format a variable of double type
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • How does Linux kernel interrupt the application?
  • Qt: Run a script BEFORE make
  • reshape alternating columns in less time and using less memory
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS