1

I use Intellij Idea. Now I'm trying to set up new system and have came up with the next issue:

  1. I've downloaded java, installed it, set JAVA_HOME(C:\Progra~2\Java\jdk1.7.0_51), added to PATH (C:\Progra~2\Java\jdk1.7.0_51\bin), checked from console java -version and %JAVA_HOME% - everything works fine (java version "1.7.0_51"Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)).
  2. I've downloaded maven, installed it, set M2_HOME(C:\Progra~2\Java\maven), added to PATH(C:\Progra~2\Java\maven\bin), checked from console mvn -version(Apache Maven 3.3.3 2015-04-22T14:57:37+03:00) Maven home: C:\Progra~2\Java\maven Java version: 1.7.0_51, vendor: Oracle Corporation Java home: C:\Progra~2\Java\jdk1.7.0_51\jre Default locale: ru_RU, platform encoding: Cp1251 OS name: "windows 7", version: "6.1", arch: "x86", family: "windows") and enter cd %M2_HOME% - it goes there normally.

But when I try to do mvn -clean or -install or any other action from Intellij, it says:

-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.
Process finished with exit code 1
J is for Java
  • 345
  • 1
  • 4
  • 12
  • when re-reading question, I've noticed that sometimes system points to jre inside jdk, may be that is the reason ? – J is for Java May 17 '15 at 09:56
  • Restart your computer, all changes in PATH requires that. The only exception is when you will change it from cmd, then the changes are immediate. – Tomek May 17 '15 at 10:05
  • @Tomek, yes, I've rebooted my computer – J is for Java May 17 '15 at 10:33
  • also related http://stackoverflow.com/questions/29330577/maven-3-3-1-eclipse-dmaven-multimoduleprojectdirectory-system-propery-is-not-s –  May 17 '15 at 10:52
  • @RC., nope, it's not related, because I use Idea and I've tried to add the arguments and nothing happened – J is for Java May 17 '15 at 10:56

2 Answers2

3

If you use the newest Maven 3.3.3 you have to take care of the new calling design. It changed from bat to cmd files. Your IDE probably isn't right now compatible to this new design. Try to take an older version of maven.

Maybe you have a look here too: `-Dmaven.multiModuleProjectDirectory not set` issue with Maven and IntelliJ

Community
  • 1
  • 1
aw-think
  • 4,723
  • 2
  • 21
  • 42
  • hmmm... ok, I'll try an older version of maven. FIY, I'm using Idea 13 version, I'll check your version and answer ASAP – J is for Java May 17 '15 at 10:39
  • Normaly all IDE will call on windows the mvn.bat, but this was replaced by maven since the 3.3.3 version by a mvn.cmd file in bin dir. This was a problem to me with netbeans 8.0.2 too. Maven version 3.2.5 works for me. – aw-think May 17 '15 at 10:40
  • thanks for your help! I've also unpacked 3.2.5 version and now everything works great! thank you! – J is for Java May 17 '15 at 11:05
0

IntelliJ ships with a bundled Maven thus your settings and maven installation will not be picked up unless you explicitly specify Intellij to use your maven installation and not the bundled one.

You can verify it under: Maven Settings (use CTRL+SHIFT+A to find it if you can't locate it) enter image description here

dubes
  • 5,324
  • 3
  • 34
  • 47