You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/01/06 15:57:03 UTC
[maven-integration-testing] branch master updated: [MNG-5561] Plugin relocation loses configuration
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
The following commit(s) were added to refs/heads/master by this push:
new e06a288 [MNG-5561] Plugin relocation loses configuration
e06a288 is described below
commit e06a28840f202d244188177cd7e24fa41d29061f
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Dec 25 23:56:57 2021 +0100
[MNG-5561] Plugin relocation loses configuration
This closes #132
---
.../org/apache/maven/it/IntegrationTestSuite.java | 1 +
...5561PluginRelocationLosesConfigurationTest.java | 63 ++++++++++++++++++++++
.../new-plugin/pom.xml | 37 +++++++++++++
.../org/apache/maven/its/mng5561/EchoMojo.java | 27 ++++++++++
.../old-plugin-with-relocation/pom.xml | 44 +++++++++++++++
.../org/apache/maven/its/mng5561/EchoMojo.java | 27 ++++++++++
.../project/pom.xml | 37 +++++++++++++
7 files changed, 236 insertions(+)
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index 6df4277..277719d 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -106,6 +106,7 @@ public class IntegrationTestSuite
// Tests that don't run stable and need to be fixed
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng5561PluginRelocationLosesConfigurationTest.class );
suite.addTestSuite( MavenITmng7335MissingJarInParallelBuild.class );
suite.addTestSuite( MavenITmng4463DependencyManagementImportVersionRanges.class );
suite.addTestSuite( MavenITmng7112ProjectsWithNonRecursiveTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5561PluginRelocationLosesConfigurationTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5561PluginRelocationLosesConfigurationTest.java
new file mode 100644
index 0000000..5832260
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5561PluginRelocationLosesConfigurationTest.java
@@ -0,0 +1,63 @@
+package org.apache.maven.it;
+
+/*
+ * 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 org.apache.maven.it.util.ResourceExtractor;
+
+public class MavenITmng5561PluginRelocationLosesConfigurationTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng5561PluginRelocationLosesConfigurationTest()
+ {
+ super( "[3.8.5,)" );
+ }
+
+ public void testit()
+ throws Exception
+ {
+ File testDir =
+ ResourceExtractor.simpleExtractResources( getClass(),
+ "/mng-5561-plugin-relocation-loses-configuration" );
+ File oldPluginWithRelocationDir = new File( testDir, "old-plugin-with-relocation" );
+ File newPluginDir = new File( testDir, "new-plugin" );
+ File projectDir = new File( testDir, "project" );
+
+ Verifier verifier;
+
+ verifier = newVerifier( oldPluginWithRelocationDir.getAbsolutePath() );
+ verifier.executeGoal( "install" );
+ verifier.resetStreams();
+ verifier.verifyErrorFreeLog();
+
+ verifier = newVerifier( newPluginDir.getAbsolutePath() );
+ verifier.executeGoal( "install" );
+ verifier.resetStreams();
+ verifier.verifyErrorFreeLog();
+
+ verifier = newVerifier( projectDir.getAbsolutePath() );
+ verifier.executeGoal( "verify" );
+ verifier.resetStreams();
+ verifier.verifyErrorFreeLog();
+ verifier.verifyTextInLog( "[WARNING] Hello from Maven!" );
+ }
+}
diff --git a/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/new-plugin/pom.xml b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/new-plugin/pom.xml
new file mode 100644
index 0000000..4bd249f
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/new-plugin/pom.xml
@@ -0,0 +1,37 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng5561.plugins</groupId>
+ <artifactId>enhanced-echo-maven-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
+ <maven-version>3.1.1</maven-version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven-version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${maven-version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.3</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/new-plugin/src/main/java/org/apache/maven/its/mng5561/EchoMojo.java b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/new-plugin/src/main/java/org/apache/maven/its/mng5561/EchoMojo.java
new file mode 100644
index 0000000..f169935
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/new-plugin/src/main/java/org/apache/maven/its/mng5561/EchoMojo.java
@@ -0,0 +1,27 @@
+package org.apache.maven.its.mng5561;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.project.MavenProject;
+
+@Mojo( name = "echoMojo", defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true )
+public class EchoMojo extends AbstractMojo
+{
+ @Parameter( defaultValue = "World!" )
+ String helloString;
+
+ @Parameter( defaultValue = "${project}", readonly = true )
+ protected MavenProject mavenProject;
+
+ @Override
+ public void execute() throws MojoExecutionException
+ {
+ getLog().warn( "=====================================================================================" );
+ getLog().warn( "Hello " + helloString );
+ getLog().warn( "=====================================================================================" );
+ }
+}
diff --git a/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/old-plugin-with-relocation/pom.xml b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/old-plugin-with-relocation/pom.xml
new file mode 100644
index 0000000..3f09118
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/old-plugin-with-relocation/pom.xml
@@ -0,0 +1,44 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng5561</groupId>
+ <artifactId>echo-maven-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
+ <maven-version>3.1.1</maven-version>
+ </properties>
+
+ <distributionManagement>
+ <relocation>
+ <groupId>org.apache.maven.its.mng5561.plugins</groupId>
+ <artifactId>enhanced-echo-maven-plugin</artifactId>
+ </relocation>
+ </distributionManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven-version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${maven-version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.3</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/old-plugin-with-relocation/src/main/java/org/apache/maven/its/mng5561/EchoMojo.java b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/old-plugin-with-relocation/src/main/java/org/apache/maven/its/mng5561/EchoMojo.java
new file mode 100644
index 0000000..f169935
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/old-plugin-with-relocation/src/main/java/org/apache/maven/its/mng5561/EchoMojo.java
@@ -0,0 +1,27 @@
+package org.apache.maven.its.mng5561;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.project.MavenProject;
+
+@Mojo( name = "echoMojo", defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true )
+public class EchoMojo extends AbstractMojo
+{
+ @Parameter( defaultValue = "World!" )
+ String helloString;
+
+ @Parameter( defaultValue = "${project}", readonly = true )
+ protected MavenProject mavenProject;
+
+ @Override
+ public void execute() throws MojoExecutionException
+ {
+ getLog().warn( "=====================================================================================" );
+ getLog().warn( "Hello " + helloString );
+ getLog().warn( "=====================================================================================" );
+ }
+}
diff --git a/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/project/pom.xml b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/project/pom.xml
new file mode 100644
index 0000000..8b17bd2
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5561-plugin-relocation-loses-configuration/project/pom.xml
@@ -0,0 +1,37 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng5561</groupId>
+ <artifactId>project</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng5561</groupId>
+ <artifactId>echo-maven-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <configuration>
+ <helloString>from Maven!</helloString>
+ </configuration>
+ <executions>
+ <execution>
+ <id>echoMojo</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>echoMojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>