I've been trying to configure Maven and IntelliJ as I'd like to play with Spring MVC and Maven.
I've followed several guides, and still have issues.
Maven 3.2.5 is installed as is Java 1.6. This has ben confirmed by running -version
on them from terminal:
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /Users/SteveGreen/Development/apache-maven-3.2.5
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.10.2", arch: "x86_64", family: "mac"
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
I've then set the home variables as per guides 1,3,4,5,6,7 and 82. results are:
Steves-MacBook-Pro:~ SteveGreen$ echo $JAVA_HOME
/usr/libexec/java_home
Steves-MacBook-Pro:~ SteveGreen$ echo $M2_HOME
/Users/SteveGreen/Development/apache-maven-3.2.5
Steves-MacBook-Pro:~ SteveGreen$ echo $M2
/Users/SteveGreen/Development/apache-maven-3.2.5/bin
Steves-MacBook-Pro:~ SteveGreen$ echo $PATH
/Users/SteveGreen/Development/apache-maven-3.2.5/bin:/usr/local/b `in:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin`
Another guide then suggested that I edit the bash profile. Which i dutifully did:
JAVA_HOME=/usr/libexec/java_home
M2_HOME=/Users/SteveGreen/Development/apache-maven-3.2.5
M2=/Users/SteveGreen/Development/apache-maven-3.2.5/bin
PATH=/Users/SteveGreen/Development/apache-maven-3.2.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
and then another suggested changing launchd.conf:
setenv JAVA_VERSION 1.6
setenv JAVA_HOME /usr/libexec/java_home
setenv M2_HOME /Users/SteveGreen/Development/apache-maven-3.2.5
and os after all this I though, ha! I have you! But no, intelliJ installing me that there is 'No valid maven installation found . either set the home directory in the configuration dialog or se the M2_HOME variable on your system'
I've tried placing the install dir of Maven in the config dig but still no joy.
Can someone please release me form this misery and suggest a solution? Thanks!
Edit: After following the suggestion in the accepted answer I'm presented with:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java --package -Dmaven.home=/Users/SteveGreen/Development/apache-maven-3.2.5 -Didea.modules.paths.file=/Users/SteveGreen/Library/Caches/IntelliJIdea13/Maven/idea-projects-state-96e43199.properties -Dclassworlds.conf=/var/folders/bj/bcfll90d46v1bsgb0bwqlzmr0000gp/T/idea-7288361697308129462-mvn.conf -Didea.launcher.port=7536 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Users/SteveGreen/Development/apache-maven-3.2.5/boot/plexus-classworlds-2.5.2.jar:/Applications/IntelliJ IDEA 13.app/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=13.1.3
Unrecognized option: --package
Could not create the Java virtual machine.
Process finished with exit code 1
again, any help is appreciated.