From 3cb3dbe2fa16a1e545d8da98411811ed490b7713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 26 Dec 2021 11:15:17 +0100 Subject: [PATCH] [MWRAPPER-14] remove wrapper-related ITs: not in core any more --- its/README.md | 12 +- its/core-it-suite/pom.xml | 55 ----- .../apache/maven/it/IntegrationTestSuite.java | 1 - .../maven/it/MavenITmng5937MavenWrapper.java | 194 ------------------ .../resources/mng-5937 wrapper/bin/pom.xml | 28 --- .../mng-5937 wrapper/properties/pom.xml | 31 --- .../resources/mng-5937 wrapper/script/pom.xml | 28 --- .../resources/mng-5937 wrapper/source/pom.xml | 28 --- its/run-its.bat | 24 +-- its/run-its.sh | 16 +- 10 files changed, 5 insertions(+), 412 deletions(-) delete mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java delete mode 100644 its/core-it-suite/src/test/resources/mng-5937 wrapper/bin/pom.xml delete mode 100644 its/core-it-suite/src/test/resources/mng-5937 wrapper/properties/pom.xml delete mode 100644 its/core-it-suite/src/test/resources/mng-5937 wrapper/script/pom.xml delete mode 100644 its/core-it-suite/src/test/resources/mng-5937 wrapper/source/pom.xml diff --git a/its/README.md b/its/README.md index e2e0cb75b4..4617bb6fc3 100644 --- a/its/README.md +++ b/its/README.md @@ -24,17 +24,7 @@ Maven Core Integration Tests If you want to run the integration tests against a custom build of Maven use the following command: ``` -export MAVENCODEBASE= -``` - -You can choose to build the maven project from here with: -``` -mvn verify -P local-it -f "$MAVENCODEBASE" -``` - -Now run (don't forget to update the versions!) -``` -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" +mvn clean install -Prun-its -Dmaven.repo.local=`pwd`/repo -DmavenDistro=/path/to/apache-maven-dist.zip ``` or if behind a proxy diff --git a/its/core-it-suite/pom.xml b/its/core-it-suite/pom.xml index f6e3a10d59..2bccdb1366 100644 --- a/its/core-it-suite/pom.xml +++ b/its/core-it-suite/pom.xml @@ -58,12 +58,6 @@ under the License. ITs that don't require to fork Maven can also be run from the IDE using the Maven projects from the workspace if the Maven dependencies are added to the test class path. - To test with the maven wrapper, you should add the wrapperDistroDir too. - - mvn clean test -Prun-its -Dmaven.repo.local= -DmavenDistro= -DwrapperDistroDir= -DmavenWrapper= - - Tests can pick up the maven.wrapper.distrodir system property to unpack it into their testDir to verify the wrapper. - If you're behind a proxy, use the system properties proxy.host, proxy.port, proxy.user, proxy.pass and proxy.nonProxyHosts to specify the required proxy setup for the ITs. Alternatively, set the system property maven.it.central to a URL of a local repository manager (anonymous authentication only) that proxies the @@ -147,17 +141,6 @@ under the License. guava 16.0 - - org.codehaus.plexus - plexus-archiver - 3.6.0 - - - org.eclipse.sisu - org.eclipse.sisu.plexus - 0.3.4 - provided - org.apache.maven maven-repository-metadata @@ -198,14 +181,6 @@ under the License. maven.it.global-settings.dir ${project.build.testOutputDirectory} - - maven.wrapper.distrodir - ${wrapperDistroDir} - - - maven.distro - ${mavenDistro} - @@ -482,36 +457,6 @@ under the License. - - maven-wrapper - - - mavenWrapper - - - - - - org.apache.maven.plugins - maven-install-plugin - 2.5.2 - - - - prepare-wrapper - process-test-resources - - install-file - - - ${mavenWrapper} - - - - - - - emma diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 97fdc37878..6df42774a2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -148,7 +148,6 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng6057CheckReactorOrderTest.class ); suite.addTestSuite( MavenITmng5965ParallelBuildMultipliesWorkTest.class ); suite.addTestSuite( MavenITmng5958LifecyclePhaseBinaryCompat.class ); - suite.addTestSuite( MavenITmng5937MavenWrapper.class ); suite.addTestSuite( MavenITmng5935OptionalLostInTranstiveManagedDependenciesTest.class ); suite.addTestSuite( MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.class ); suite.addTestSuite( MavenITmng5895CIFriendlyUsageWithPropertyTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java deleted file mode 100644 index d7107c9061..0000000000 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5937MavenWrapper.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.apache.maven.it; - -import java.io.BufferedWriter; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.charset.StandardCharsets; -import java.nio.file.StandardOpenOption; -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.plexus.archiver.zip.ZipUnArchiver; -import org.codehaus.plexus.logging.console.ConsoleLogger; -import org.codehaus.plexus.util.StringUtils; - -/** - * This is a test set for MNG-5937. - * - */ -public class MavenITmng5937MavenWrapper - extends AbstractMavenIntegrationTestCase -{ - private Path wrapperDistro; - - private final Map envVars; - - private final Path baseDir = Paths.get( "target/test-classes/mng-5937 wrapper" ); - - private ZipUnArchiver zipUnArchiver = new ZipUnArchiver(); - - public MavenITmng5937MavenWrapper() - throws Exception - { - super( "[4.0.0-alpha-1,)" ); - - envVars = new HashMap<>( 4 ); - - if ( !isSkipped() ) - { - 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 ) ) - { - throw new IllegalStateException( "Missing maven.distro=${mavenDistro} parameter to test maven-wrapper: see run ITs instructions" ); - } - - Verifier distInstaller = newVerifier( baseDir.toAbsolutePath().toFile().toString() ); - distInstaller.setSystemProperty( "file", mavenDist ); - distInstaller.setSystemProperty( "groupId", "org.apache.maven" ); - distInstaller.setSystemProperty( "artifactId", "apache-maven" ); - distInstaller.setSystemProperty( "version", getMavenVersion().toString() ); - distInstaller.setSystemProperty( "classifier", "bin" ); - distInstaller.setSystemProperty( "packaging", "zip" ); - distInstaller.executeGoal( "org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file" ); - - String distroValue = System.getProperty( "maven.wrapper.distrodir" ); - if ( StringUtils.isEmpty( distroValue ) ) - { - throw new IllegalStateException( "Missing maven.wrapper.distrodir=${wrapperDistroDir} parameter to test maven-wrapper: see run ITs instructions" ); - } - wrapperDistro = Paths.get( distroValue ); - } - - public void testitMNG5937Bin() - throws Exception - { - final File testDir = baseDir.resolve( "bin" ).toFile(); - - unpack( testDir.toPath(), "bin" ); - - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setDebug( true ); - verifier.executeGoal( "validate", envVars ); - verifier.verifyErrorFreeLog(); - verifier.resetStreams(); - } - - public void testitMNG5937Script() - throws Exception - { - final File testDir = baseDir.resolve( "script" ).toFile(); - - unpack( testDir.toPath(), "script" ); - - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setDebug( true ); - verifier.executeGoal( "validate", envVars ); - verifier.verifyErrorFreeLog(); - verifier.resetStreams(); - } - - public void testitMNG5937Source() - throws Exception - { - final File testDir = baseDir.resolve( "source" ).toFile(); - - unpack( testDir.toPath(), "source" ); - - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setDebug( true ); - verifier.executeGoal( "validate", envVars ); - verifier.verifyErrorFreeLog(); - verifier.resetStreams(); - } - - public void testitMNG5937WrapperProperties() - throws Exception - { - final File testDir = baseDir.resolve( "properties" ).toFile(); - - unpack( testDir.toPath(), "bin" ); - - Path p = baseDir.resolve( "properties/.mvn/wrapper/maven-wrapper.properties" ); - try ( BufferedWriter out = Files.newBufferedWriter( p, StandardCharsets.ISO_8859_1, - StandardOpenOption.TRUNCATE_EXISTING ) ) - { - String localRepo = System.getProperty("maven.repo.local"); - out.append( "distributionUrl = " + Paths.get( localRepo ).toUri().toASCIIString() ) - .append( "org/apache/maven/apache-maven/") - .append( getMavenVersion().toString() ) - .append( "/apache-maven-") - .append( getMavenVersion().toString() ) - .append( "-bin.zip" ); - } - - envVars.remove( "MVNW_REPOURL" ); - - Verifier verifier = newVerifier( testDir.getAbsolutePath() ); - verifier.setAutoclean( false ); - verifier.setDebug( true ); - verifier.executeGoal( "validate", envVars ); - verifier.verifyErrorFreeLog(); - verifier.resetStreams(); - } - - private void unpack( Path target, String classifier ) throws IOException - { - Path distro = wrapperDistro.resolve( "apache-maven-wrapper-" + getMavenVersion() + '-' + classifier + ".zip" ); - - zipUnArchiver.setSourceFile( distro.toFile() ); - zipUnArchiver.setDestDirectory( target.toFile() ); - zipUnArchiver.enableLogging( new ConsoleLogger() ); - - zipUnArchiver.extract(); - } -} diff --git a/its/core-it-suite/src/test/resources/mng-5937 wrapper/bin/pom.xml b/its/core-it-suite/src/test/resources/mng-5937 wrapper/bin/pom.xml deleted file mode 100644 index 05b46fa7e6..0000000000 --- a/its/core-it-suite/src/test/resources/mng-5937 wrapper/bin/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - 4.0.0 - - org.apache.maven.its.mng5937 - test - 1 - diff --git a/its/core-it-suite/src/test/resources/mng-5937 wrapper/properties/pom.xml b/its/core-it-suite/src/test/resources/mng-5937 wrapper/properties/pom.xml deleted file mode 100644 index 8fee7fdac5..0000000000 --- a/its/core-it-suite/src/test/resources/mng-5937 wrapper/properties/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - 4.0.0 - - org.apache.maven.its.mng5937 - test - 1 - - Maven Integration Test :: MNG-5937 - - diff --git a/its/core-it-suite/src/test/resources/mng-5937 wrapper/script/pom.xml b/its/core-it-suite/src/test/resources/mng-5937 wrapper/script/pom.xml deleted file mode 100644 index 05b46fa7e6..0000000000 --- a/its/core-it-suite/src/test/resources/mng-5937 wrapper/script/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - 4.0.0 - - org.apache.maven.its.mng5937 - test - 1 - diff --git a/its/core-it-suite/src/test/resources/mng-5937 wrapper/source/pom.xml b/its/core-it-suite/src/test/resources/mng-5937 wrapper/source/pom.xml deleted file mode 100644 index 05b46fa7e6..0000000000 --- a/its/core-it-suite/src/test/resources/mng-5937 wrapper/source/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - 4.0.0 - - org.apache.maven.its.mng5937 - test - 1 - diff --git a/its/run-its.bat b/its/run-its.bat index 4463230ac1..4b73810400 100644 --- a/its/run-its.bat +++ b/its/run-its.bat @@ -16,28 +16,10 @@ @REM specific language governing permissions and limitations @REM under the License. @REM -@ECHO OFF -@IF "%MAVENCODEBASE%"=="" ( - @ECHO Please SET MAVENCODEBASE / $env:MAVENCODEBASE - @GOTO :eof -) -CALL :normalizePath %MAVENCODEBASE% +@REM How JvZ runs the ITs from a clean slate if it would be on Windows + +mvn clean install -U -Prun-its,embedded -Dmaven.repo.local=%cd%\repo @REM If behind a proxy try this.. @REM mvn clean install -Prun-its,embedded -Dmaven.repo.local=%cd%\repo -Dproxy.host= -Dproxy.port= -Dproxy.user= -Dproxy.pass= -Dproxy.nonProxyHosts= - -:: ========== FUNCTIONS ========== - -CALL mvn clean verify -DdistributionFileName=${project.artifactId} -f "%_MAVENCODEBASE%" || exit /B - -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-wrapper\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 -) - -@GOTO :eof - -:normalizePath - SET _MAVENCODEBASE=%~dpfn1 diff --git a/its/run-its.sh b/its/run-its.sh index 7c2528e3ab..0a6bf66728 100755 --- a/its/run-its.sh +++ b/its/run-its.sh @@ -22,21 +22,7 @@ # How I run the ITs from a clean slate. Though I do this with a primed Nexus instance. JvZ. # build maven core using -PversionlessMavenDist -if [ -z "$MAVENCODEBASE" ] ; then - echo Please export MAVENCODEBASE -else - case "$MAVENCODEBASE" in - /*) ;; - *) MAVENCODEBASE="$PWD/$MAVENCODEBASE" ;; - esac - mvn clean verify -P versionlessMavenDist -f "$MAVENCODEBASE" || exit $? - 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-wrapper/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 - +mvn clean install -Prun-its,embedded -Dmaven.repo.local=`pwd`/repo # If behind a proxy try this