diff --git a/apache-maven/src/bin/mvn.bat b/apache-maven/src/bin/mvn.bat index abf793b807..546842aae5 100644 --- a/apache-maven/src/bin/mvn.bat +++ b/apache-maven/src/bin/mvn.bat @@ -200,7 +200,7 @@ goto runm2 @REM Start MAVEN2 :runm2 set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" "-Dmaven.projectBasedir=%MAVEN_PROJECTBASEDIR%" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS% if ERRORLEVEL 1 goto error goto end diff --git a/apache-maven/src/bin/mvnDebug.bat b/apache-maven/src/bin/mvnDebug.bat index 2b2cc18213..6452638fb2 100644 --- a/apache-maven/src/bin/mvnDebug.bat +++ b/apache-maven/src/bin/mvnDebug.bat @@ -204,7 +204,7 @@ goto runm2 @REM Start MAVEN2 :runm2 set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" "-Dmaven.projectBasedir=%MAVEN_PROJECTBASEDIR%" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS% if ERRORLEVEL 1 goto error goto end diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index cd368326a8..4e7e072065 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -312,6 +312,7 @@ public class MavenCli } void initialize( CliRequest cliRequest ) + throws ExitException { if ( cliRequest.workingDirectory == null ) { @@ -321,6 +322,12 @@ public class MavenCli if ( cliRequest.multiModuleProjectDirectory == null ) { String basedirProperty = System.getProperty( MULTIMODULE_PROJECT_DIRECTORY ); + if ( basedirProperty == null ) + { + System.err.format( "-D%s system propery is not set." + + " Check $M2_HOME environment variable and mvn script match.", MULTIMODULE_PROJECT_DIRECTORY ); + throw new ExitException( 1 ); + } File basedir = basedirProperty != null ? new File( basedirProperty ) : new File( "" ); try {