3

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

[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.

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?

Jonik
  • 80,077
  • 70
  • 264
  • 372
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
  • 1
    Please see my [previous answer](http://stackoverflow.com/questions/8089213/created-a-maven-project-using-quickstart-using-intellij-didnt-seem-to-generate/8089309#8089309) to your previous question. – Dave Newton Nov 22 '11 at 03:59
  • @Blankman, see my answer, it's exactly for your case and describes how to set environment variables on Mac so that they are accessible by all applications, not only in terminal – CrazyCoder Nov 22 '11 at 05:35

2 Answers2

3

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

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
0

Are you on a Linux-type system?

Is the M2_HOME variable only set when you start a terminal 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.

millhouse
  • 9,817
  • 4
  • 32
  • 40