diff --git a/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java b/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java index 6c248e39dd..05878e16d6 100644 --- a/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java +++ b/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java @@ -388,11 +388,6 @@ public void executeGoals( String filename ) { String mavenHome = System.getProperty( "maven.home" ); - if ( mavenHome == null ) - { - throw new VerificationException( "maven.home has not been specified" ); - } - List goals = loadFile( basedir, filename ); if ( goals.size() == 0 ) @@ -414,7 +409,17 @@ public void executeGoals( String filename ) cli.setWorkingDirectory( basedir ); - cli.setExecutable( "m2" ); + String executable; + if ( mavenHome != null ) + { + executable = mavenHome + "/bin/m2"; + } + else + { + executable = "m2"; + } + + cli.setExecutable( executable ); for ( Iterator i = allGoals.iterator(); i.hasNext(); ) { diff --git a/maven-core-it/maven-core-it.sh b/maven-core-it/maven-core-it.sh index ecb2b49313..08e5f5c3de 100755 --- a/maven-core-it/maven-core-it.sh +++ b/maven-core-it/maven-core-it.sh @@ -6,18 +6,8 @@ cp=../maven-core-it-verifier/target/maven-core-it-verifier-1.0.jar verifier=org.apache.maven.it.Verifier -# TODO: need a consistent way to discover M2_HOME across this, bootstrap and m2 itself, as well as have a sensible -# default, and a way to override. There must be only one way. -# I like the idea of using the one in the path, or using -Dmaven.home to override -# The m2 shell script should not care what installation it is in - it should use the installation defined on the -# command line - jvm_args="$@" -if [ ! -z "$M2_HOME" ]; then - jvm_args="$jvm_args -Dmaven.home=$M2_HOME" -fi - if [ ! -z "$MAVEN_OPTS" ]; then jvm_args="$jvm_args $MAVEN_OPTS" fi @@ -32,6 +22,11 @@ esac if $cygwin ; then [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath -w "$JAVA_HOME"` export JAVA_HOME + [ -n "$M2_HOME" ] && M2_HOME=`cygpath -w "$M2_HOME"` +fi + +if [ ! -z "$M2_HOME" ]; then + jvm_args=$jvm_args "-Dmaven.home=$M2_HOME" fi java $jvm_args -cp "$cp" $verifier