38

I am using intellij and my M2 and M2_HOME are set and are in .bash_profile, however I have this error :

No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system

any idea why it does not work with environment variable ?

akaliza
  • 3,641
  • 6
  • 24
  • 31

4 Answers4

64

Selecting "Bundled Maven" instead of "Maven wrapper" fixed the issue for me. enter image description here

Rany Albeg Wein
  • 3,304
  • 3
  • 16
  • 26
17

On Mac (I am using macOS Sierra 10.12.1, IntelliJ IDEA 2016.2).

Choose command+, , choose Build, Execution, Deployment, choose Build Tools, then press Maven

enter image description here

then set Maven home directory: correctly

for example: /Users/donhuvy/Documents/program_files/apache-maven-3.3.9

Vy Do
  • 46,709
  • 59
  • 215
  • 313
3

Check your File-->settings-->Maven, Maven directory home which should points to your maven home installed in your computer. Then, create a new M2_Home in your system environment which is also your maven home, and then add %M2_Home%\bin to your path.

Lucas Zamboulis
  • 2,494
  • 5
  • 24
  • 27
jackie
  • 31
  • 2
0

I have same issue. I think the reason for the maven auto update

There are two ways to solve the problem.:

  1. Change the Maven path and Maven setting file path.(I use it.) File->preferences->Build,Excution,Deployment...->Build Tool -> Maven.you can reset it.

  2. Reset local computer environment variable for Maven.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135