Maven 3.3.1 ECLIPSE: -Dmaven.multiModuleProjectDirectory system propery is not set

84,177

Solution 1

In Eclipse you need to go like this.

Window-> Preference -> Java -> Installed JREs -> Edit

In the edit Default VM arguments you need to put

If you already set the maven home.

-Dmaven.multiModuleProjectDirectory=$M2_HOME

Solution 2

In IntelliJ you can set this option in VM Options field that you can find in the next configuration view:

Preferences/Build, execution, deployment/Build tools/Maven/Runner

enter image description here

Solution 3

This was filed as a bug with m2e in Eclipse at https://bugs.eclipse.org/bugs/show_bug.cgi?id=462944 , due to the changes in Maven 3.3.1.

This is fixed in m2e 1.5.2 as of 2015-04-13. This is an available release that can be installed from http://download.eclipse.org/technology/m2e/releases/ .

(No more changing JVM arguments for the entire workspace or for specific launch configurations required.)

Solution 4

Define like this in the JVM options:

-Dmaven.multiModuleProjectDirectory=HOME_PATH_OF_YOU_PROJECT

Solution 5

In case you have this error message on your commandline, please verify if your PATH variable points to the same maven installation apache-maven-3.X.X/bin folder as your M2_HOME variable. In my case I was mixing up two versions which resulted in this error.

Share:
84,177
Bob
Author by

Bob

BY DAY: Alt-Rock Ninja Cowgirl at Veridian Dynamics. BY NIGHT: I write code and code rights for penalcoders.example.org, an awesome non-profit that will totally take your money at that link. My kids are cuter than yours. FOR FUN: C+ Jokes, Segway Roller Derby, NYT Sat. Crosswords (in Sharpie!), Ostrich Grooming. "If you see scary things, look for the helpers-you'll always see people helping."-Fred Rogers

Updated on November 16, 2020

Comments

  • Bob
    Bob over 3 years

    I just installed Maven 3.3.1 on Mac OS X, and building a Maven Project with Eclipse is giving me this error:

    -Dmaven.multiModuleProjectDirectory system property is not set.
    Check $M2_HOME environment variable and mvn script match.
    

    It did not happen before with Maven 3.2.5.

    Is there any way to fix this (except downgrading to 3.2.5) ?

    Where exactly can I set this "multiModuleProjectDirectory" property in Eclipse?

  • Bob
    Bob about 9 years
    Where exactly can I set the JVM Options of a Project in Eclipse?
  • Diego Macario
    Diego Macario about 9 years
    I don't know why, but when you run a maven option like clean in Eclipse it will show that is necessary.
  • atamanroman
    atamanroman about 9 years
    PROJECT_DIR makes more sense than M2_HOME.
  • specializt
    specializt about 9 years
    that variable does not exist - what you actually were trying to refer to is $PROJECT_LOC
  • ziesemer
    ziesemer about 9 years
    @atamanroman and all - this was a filed m2e bug as of 2015-03-24 , and has since been resolved. Please see stackoverflow.com/a/29735560/751158 .
  • Mykel Alvis
    Mykel Alvis about 9 years
    I get : An error occurred while collecting items to be installed session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). No repository found containing: osgi.bundle,org.aspectj.runtime.source,1.7.0.20120703164200 No repository found containing: osgi.bundle,org.eclipse.contribution.weaving.jdt.source,2.2.‌​0.e37x-RELEASE-20120‌​704-0900 + others
  • cyfur01
    cyfur01 almost 9 years
    The latest 1.5.X release should be here: download.eclipse.org/technology/m2e/milestones/1.5
  • Dreamcatcher
    Dreamcatcher over 8 years
    Also it works for IntelliJ Idea 14.0 with Maven 3.3.9
  • Bogie
    Bogie about 8 years
    You can also add the VM args from Run Configuration -> Maven Build. Select your launch configuration and open the tab JRE. Add -Dmaven.multiModuleProjectDirectory=$M2_HOME in VM arguments textbox.
  • Shubha S
    Shubha S about 7 years
    I followed the solution and still I was seeing the same error.That was because the maven project had reference to jre 1.7 But JAVA_HOME was set to jre1.8.Making Maven project to point to the jre 1.8 in configure Build path->java build path solved the issue.