Make tests verifiable with at least Maven 3.6.3

This commit is contained in:
rfscholte 2021-01-16 14:41:17 +01:00 committed by Michael Osipov
parent 218ce6c7e7
commit a469fd5823
6 changed files with 56 additions and 12 deletions

View File

@ -61,7 +61,14 @@ public class MavenITmng5572ReactorPluginExtensionsTest
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();
}

View File

@ -54,23 +54,34 @@ public class MavenITmng5937MavenWrapper
{
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 ) )
{

View File

@ -55,7 +55,14 @@ public class MavenITmng6759TransitiveDependencyRepositoriesTest extends Abstract
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;

View File

@ -202,6 +202,16 @@ public abstract class AbstractMavenIntegrationTestCase
}
}
/**
* Can be called by version specific setUp calls
*
* @return
*/
protected final boolean isSkipped()
{
return skip;
}
protected void runTest()
throws Throwable
{

View File

@ -37,7 +37,12 @@ CALL :maven && CALL :maven-integration-testing
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

View File

@ -30,7 +30,11 @@ else
*) 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