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 f93e432da1..026b4b01d0 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 @@ -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 ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6240PluginExtensionAetherProvider.java new file mode 100644 index 0000000000..6fb542d4dc --- /dev/null +++ b/its/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 MNG-6240. + * + * @author gboue + */ +public class MavenITmng6240PluginExtensionAetherProvider + extends AbstractMavenIntegrationTestCase +{ + public MavenITmng6240PluginExtensionAetherProvider() + { + super( "[3.5.1,)" ); + } + + /** + *
+ * 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. + *
+ * 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