maven-integration-testing git commit: [MNG-6240] Duplicate components in plugin extension realm when plugin depends on maven-aether-resolver

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

maven-integration-testing git commit: [MNG-6240] Duplicate components in plugin extension realm when plugin depends on maven-aether-resolver

gboue
Repository: maven-integration-testing
Updated Branches:
  refs/heads/master c7dae6d21 -> a162291ef


[MNG-6240] Duplicate components in plugin extension realm when plugin depends on maven-aether-resolver

Maven Core needs to export the maven-aether-provider artifact so that its components do not get added twice in plugin realm. This happens if the build uses an extension plugin depending on maven-aether-provider, before it was renamed to maven-resolver-provider


Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/a162291e
Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/a162291e
Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/a162291e

Branch: refs/heads/master
Commit: a162291ef72059a67fac816dbc905b7702c57456
Parents: c7dae6d
Author: Guillaume Boué <[hidden email]>
Authored: Fri Jun 9 23:24:00 2017 +0200
Committer: Guillaume Boué <[hidden email]>
Committed: Fri Jun 9 23:24:00 2017 +0200

----------------------------------------------------------------------
 .../apache/maven/it/IntegrationTestSuite.java   |  1 +
 ...nITmng6240PluginExtensionAetherProvider.java | 81 ++++++++++++++++++++
 .../plugin-extension/pom.xml                    | 46 +++++++++++
 .../org/apache/maven/its/plugin/TestMojo.java   | 36 +++++++++
 .../project/pom.xml                             | 47 ++++++++++++
 5 files changed, 211 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/a162291e/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
----------------------------------------------------------------------
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 f93e432..026b4b0 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
         // -------------------------------------------------------------------------------------------------------------
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
 
+        suite.addTestSuite( MavenITmng6240PluginExtensionAetherProvider.class );
         suite.addTestSuite( MavenITmng6223FindBasedir.class );
         suite.addTestSuite( MavenITmng6189SiteReportPluginsWarningTest.class );
         suite.addTestSuite( MavenITmng6057CheckReactorOrderTest.class );

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/a162291e/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java
new file mode 100644
index 0000000..6fb542d
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java
@@ -0,0 +1,81 @@
+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 java.util.List;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-6240">MNG-6240</a>.
+ *
+ * @author gboue
+ */
+public class MavenITmng6240PluginExtensionAetherProvider
+    extends AbstractMavenIntegrationTestCase
+{
+    public MavenITmng6240PluginExtensionAetherProvider()
+    {
+        super( "[3.5.1,)" );
+    }
+
+    /**
+     * <p>
+     * Checks that there are no duplicate classes from maven-aether-provider on the classpath, when the build has a
+     * plugin extension that depends on the former maven-aether-provider, renamed to maven-resolver-provider.
+     * <p>
+     * One way to do this is to look at MetadataGeneratorFactory, which is a class of this module: there should only be
+     * two instances (one of SnapshotMetadataGeneratorFactory and VersionsMetadataGeneratorFactory). When there are
+     * more, the Deploy Plugin will perform the download / upload of artifact metadata multiple times. This can be
+     * verified easily from the logs.
+     */
+    public void testPluginExtensionDependingOnMavenAetherProvider()
+        throws Exception
+    {
+        File testDir =
+            ResourceExtractor.simpleExtractResources( getClass(), "/mng-6240-plugin-extension-aether-provider" );
+        File pluginDir = new File( testDir, "plugin-extension" );
+        File projectDir = new File( testDir, "project" );
+
+        Verifier verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
+        verifier.executeGoal( "install" );
+        verifier.resetStreams();
+        verifier.verifyErrorFreeLog();
+
+        verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
+        verifier.executeGoal( "deploy" );
+        verifier.resetStreams();
+        verifier.verifyErrorFreeLog();
+
+        List<String> lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
+        int count = 0;
+        for ( String line : lines )
+        {
+            if ( line.endsWith( "/repo/org/apache/maven/its/mng6240/project/1.0-SNAPSHOT/maven-metadata.xml" ) )
+            {
+                count++;
+            }
+        }
+        assertTrue( count == 2 ); // 1 from download, 1 from upload
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/a162291e/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/plugin-extension/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/plugin-extension/pom.xml b/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/plugin-extension/pom.xml
new file mode 100644
index 0000000..8afe9ac
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/plugin-extension/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<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 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.its.mng6240</groupId>
+  <artifactId>plugin-extension</artifactId>
+  <version>1.0</version>
+  <packaging>maven-plugin</packaging>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven-version>3.3.9</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-aether-provider</artifactId>
+      <version>${maven-version}</version>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/a162291e/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/plugin-extension/src/main/java/org/apache/maven/its/plugin/TestMojo.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/plugin-extension/src/main/java/org/apache/maven/its/plugin/TestMojo.java b/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/plugin-extension/src/main/java/org/apache/maven/its/plugin/TestMojo.java
new file mode 100644
index 0000000..a16a27d
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/plugin-extension/src/main/java/org/apache/maven/its/plugin/TestMojo.java
@@ -0,0 +1,36 @@
+package org.apache.maven.its.mng6209.multiple.build.extensions.pluginb;
+
+/*
+ * 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 org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * @goal test
+ */
+public class TestMojo
+    extends AbstractMojo
+{
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/a162291e/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/project/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/project/pom.xml b/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/project/pom.xml
new file mode 100644
index 0000000..66a15c8
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6240-plugin-extension-aether-provider/project/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<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 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.its.mng6240</groupId>
+  <artifactId>project</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <distributionManagement>
+    <snapshotRepository>
+      <id>local-repo</id>
+      <url>file://${project.basedir}/repo</url>
+    </snapshotRepository>
+  </distributionManagement>
+  <build>
+    <plugins>
+  <plugin>
+        <groupId>org.apache.maven.its.mng6240</groupId>
+        <artifactId>plugin-extension</artifactId>
+        <version>1.0</version>
+        <extensions>true</extensions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Loading...