Make tests verifiable with at least Maven 3.6.3
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5572ReactorPluginExtensionsTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5572ReactorPluginExtensionsTest.java
index f82ee8c..433ebc6 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5572ReactorPluginExtensionsTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5572ReactorPluginExtensionsTest.java
@@ -61,7 +61,14 @@
verifier.setAutoclean( false );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
- verifier.verifyTextInLog( "[WARNING] 'project' uses 'org.apache.maven.its.mng5572:plugin' as extension which is not possible within the same reactor build. This plugin was pulled from the local repository!" );
+ if ( getMavenVersion().getMajorVersion() <= 3 )
+ {
+ verifier.verifyTextInLog( "[WARNING] project uses org.apache.maven.its.mng5572:plugin as extensions, which is not possible within the same reactor build. This plugin was pulled from the local repository!" );
+ }
+ else
+ {
+ verifier.verifyTextInLog( "[WARNING] 'project' uses 'org.apache.maven.its.mng5572:plugin' as extension which is not possible within the same reactor build. This plugin was pulled from the local repository!" );
+ }
verifier.resetStreams();
}
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java
index 4b47d80..5f8dff1 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java
@@ -54,23 +54,34 @@
{
super( "[4.0.0-alpha-1,)" );
- String localRepo = System.getProperty("maven.repo.local");
-
envVars = new HashMap<>( 4 );
- envVars.put( "MVNW_REPOURL", Paths.get( localRepo ).toUri().toURL().toString() );
- envVars.put( "MVNW_VERBOSE", "true" );
- String javaHome = System.getenv( "JAVA_HOME" );
- if ( javaHome != null )
+
+ if ( !isSkipped() )
{
- // source needs to call the javac executable.
- // if JAVA_HOME is not set, ForkedLauncher sets it to java.home, which is the JRE home
- envVars.put( "JAVA_HOME", javaHome );
+ String localRepo = System.getProperty( "maven.repo.local" );
+ if ( localRepo != null )
+ {
+ envVars.put( "MVNW_REPOURL", Paths.get( localRepo ).toUri().toURL().toString() );
+ envVars.put( "MVNW_VERBOSE", "true" );
+ }
+ String javaHome = System.getenv( "JAVA_HOME" );
+ if ( javaHome != null )
+ {
+ // source needs to call the javac executable.
+ // if JAVA_HOME is not set, ForkedLauncher sets it to java.home, which is the JRE home
+ envVars.put( "JAVA_HOME", javaHome );
+ }
}
}
public void setUp()
throws Exception
{
+ if ( isSkipped() )
+ {
+ return;
+ }
+
String mavenDist = System.getProperty( "maven.distro" );
if ( StringUtils.isEmpty( mavenDist ) )
{
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6759TransitiveDependencyRepositoriesTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6759TransitiveDependencyRepositoriesTest.java
index 21eae3c..45a6665 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6759TransitiveDependencyRepositoriesTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6759TransitiveDependencyRepositoriesTest.java
@@ -55,7 +55,14 @@
Verifier verifier = newVerifier( dependencyCProjectDir.getAbsolutePath() );
verifier.deleteDirectory( "target" );
- verifier.addCliOption( "-DaltDeploymentRepository=customRepo::" + customRepoUri );
+ if ( getMavenVersion().getMajorVersion() <= 3 )
+ {
+ verifier.addCliOption( "-DaltDeploymentRepository=customRepo::default::" + customRepoUri );
+ }
+ else
+ {
+ verifier.addCliOption( "-DaltDeploymentRepository=customRepo::" + customRepoUri );
+ }
verifier.executeGoal( "deploy" );
verifier.verifyErrorFreeLog();
return customRepoUri;
diff --git a/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java b/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
index bb0a101..a30b07b 100644
--- a/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
+++ b/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/AbstractMavenIntegrationTestCase.java
@@ -202,6 +202,16 @@
}
}
+ /**
+ * Can be called by version specific setUp calls
+ *
+ * @return
+ */
+ protected final boolean isSkipped()
+ {
+ return skip;
+ }
+
protected void runTest()
throws Throwable
{
diff --git a/run-its.bat b/run-its.bat
index abc501b..9bdb4fd 100644
--- a/run-its.bat
+++ b/run-its.bat
@@ -37,7 +37,12 @@
CALL mvn clean verify -DdistributionFileName=${project.artifactId} -f "%_MAVENCODEBASE%" || exit /B
:maven-integration-testing
+if exist "%_MAVENCODEBASE%\maven-wrapper\target\maven-wrapper.jar" (
CALL mvn clean install -Prun-its,embedded -Dmaven.repo.local="%cd%\repo" -DmavenDistro="%_MAVENCODEBASE%\apache-maven\target\apache-maven-bin.zip" -DwrapperDistroDir="%_MAVENCODEBASE%\apache-maven\target" -DmavenWrapper="%_MAVENCODEBASE%\maven-wrapper\target\maven-wrapper.jar" || exit /B
+)
+else (
+ CALL mvn clean install -Prun-its,embedded,!maven-wrapper -Dmaven.repo.local="%cd%\repo" -DmavenDistro="%_MAVENCODEBASE%\apache-maven\target\apache-maven-bin.zip" || exit /B
+)
:normalizePath
SET _MAVENCODEBASE=%~dpfn1
diff --git a/run-its.sh b/run-its.sh
index 028c39a..2f85609 100755
--- a/run-its.sh
+++ b/run-its.sh
@@ -30,7 +30,11 @@
*) MAVENCODEBASE="$PWD/$MAVENCODEBASE" ;;
esac
mvn clean verify -P versionlessMavenDist -f "$MAVENCODEBASE" || exit $?
- mvn clean install -Prun-its,embedded -Dmaven.repo.local=`pwd`/repo -DmavenDistro="$MAVENCODEBASE/apache-maven/target/apache-maven-bin.zip" -DwrapperDistroDir="$MAVENCODEBASE/apache-maven/target" -DmavenWrapper="$MAVENCODEBASE/maven-wrapper/target/maven-wrapper.jar"
+ if [ -f "$MAVENCODEBASE/maven-wrapper/target/maven-wrapper.jar" ] ; then
+ mvn clean install -Prun-its,embedded -Dmaven.repo.local=`pwd`/repo -DmavenDistro="$MAVENCODEBASE/apache-maven/target/apache-maven-bin.zip" -DwrapperDistroDir="$MAVENCODEBASE/apache-maven/target" -DmavenWrapper="$MAVENCODEBASE/maven-wrapper/target/maven-wrapper.jar" || exit $
+ else
+ mvn clean install -Prun-its,embedded,!maven-wrapper -Dmaven.repo.local=`pwd`/repo -DmavenDistro="$MAVENCODEBASE/apache-maven/target/apache-maven-bin.zip" || exit $?
+ fi
fi