Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 703
akaliza Avatar asked Nov 17 '13 13:11

akaliza


People also ask

Is not a valid maven home directory?

This error message means that the folder named "maven" that you've chosen does not contain maven installation. The default Maven Home Directory was the m2 folder. Normally, by default you'll see either the embeded maven or the value of M2_HOME environment variable.

How do I change the maven home directory in Intellij?

From the main menu select File | Settings/Preferences | Build, Execution, Deployment |Build Tools | Maven. On the Maven settings page, in the Maven home directory field, specify the location of the Maven custom version installation.

How do I set my m2 at home?

Set M2_HOME & PATHCreate an environment variable named M2_HOME which refers to directory where maven was untarred/ unzipped. and then add this variable to PATH environment variable. $>export PATH=$M2_HOME/bin:$PATH. Click OK, then Edit the 'Path' user variable to add M2_HOME\bin folder in it.


2 Answers

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

like image 174
Rany Albeg Wein Avatar answered Sep 16 '22 15:09

Rany Albeg Wein


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

like image 38
Do Nhu Vy Avatar answered Sep 19 '22 15:09

Do Nhu Vy