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 324f36939b..a816117b01 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
@@ -82,6 +82,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng4654ArtifactHandlerForMainArtifactTest.class );
suite.addTestSuite( MavenITmng4644StrictPomParsingRejectsMisplacedTextTest.class );
suite.addTestSuite( MavenITmng4629NoPomValidationErrorUponMissingSystemDepTest.class );
suite.addTestSuite( MavenITmng4625SettingsXmlInterpolationWithXmlMarkupTest.class );
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4654ArtifactHandlerForMainArtifactTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4654ArtifactHandlerForMainArtifactTest.java
new file mode 100644
index 0000000000..0afba65fb2
--- /dev/null
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4654ArtifactHandlerForMainArtifactTest.java
@@ -0,0 +1,65 @@
+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 org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * This is a test set for MNG-4654.
+ *
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4654ArtifactHandlerForMainArtifactTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng4654ArtifactHandlerForMainArtifactTest()
+ {
+ super( "[3.0-alpha-3,)" );
+ }
+
+ /**
+ * Test that the artifact handler for the project main artifact is selected via the handler's type/roleHint
+ * and not via the handler's packaging (the packaging only applies to the legacy repo layout).
+ */
+ public void testit()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4654" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.deleteArtifacts( "org.apache.maven.its.mng4654" );
+ verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
+ verifier.getCliOptions().add( "--settings" );
+ verifier.getCliOptions().add( "settings.xml" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ verifier.assertFileNotPresent( "target/repo/org/apache/maven/its/mng4654/test/1.0/test-1.0.mng4654" );
+ verifier.assertFilePresent( "target/repo/org/apache/maven/its/mng4654/test/1.0/test-1.0.jar" );
+ }
+
+}
diff --git a/its/core-it-suite/src/test/resources/mng-4654/pom.xml b/its/core-it-suite/src/test/resources/mng-4654/pom.xml
new file mode 100644
index 0000000000..fee002d69a
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4654/pom.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng4654
+ test
+ 1.0
+ mng4654
+
+ Maven Integration Test :: MNG-4654
+
+ Test that the artifact handler for the project main artifact is selected via the handler's type/roleHint
+ and not via the handler's packaging (the packaging only applies to the legacy repo layout).
+
+
+
+
+ maven-core-it
+ file:///${basedir}/target/repo
+
+
+
+
+
+
+ org.apache.maven.its.mng4654
+ maven-ext-plugin
+ 1.0
+ true
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-artifact
+ 2.1-SNAPSHOT
+
+ pom.xml
+
+
+
+ test
+ validate
+
+ set
+ install
+ deploy
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-4654/repo/org/apache/maven/its/mng4654/maven-ext-plugin/1.0/maven-ext-plugin-1.0.jar b/its/core-it-suite/src/test/resources/mng-4654/repo/org/apache/maven/its/mng4654/maven-ext-plugin/1.0/maven-ext-plugin-1.0.jar
new file mode 100644
index 0000000000..5f318ebb7a
Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-4654/repo/org/apache/maven/its/mng4654/maven-ext-plugin/1.0/maven-ext-plugin-1.0.jar differ
diff --git a/its/core-it-suite/src/test/resources/mng-4654/repo/org/apache/maven/its/mng4654/maven-ext-plugin/1.0/maven-ext-plugin-1.0.pom b/its/core-it-suite/src/test/resources/mng-4654/repo/org/apache/maven/its/mng4654/maven-ext-plugin/1.0/maven-ext-plugin-1.0.pom
new file mode 100644
index 0000000000..079ca54fc4
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4654/repo/org/apache/maven/its/mng4654/maven-ext-plugin/1.0/maven-ext-plugin-1.0.pom
@@ -0,0 +1,44 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng4654
+ maven-ext-plugin
+ 1.0
+ maven-plugin
+
+
+
+ maven-core-it
+ file:///${basedir}/repo
+
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.0
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-4654/settings-template.xml b/its/core-it-suite/src/test/resources/mng-4654/settings-template.xml
new file mode 100644
index 0000000000..cde4215860
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-4654/settings-template.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+ maven-core-it-repo
+
+
+ maven-core-it
+ @baseurl@/repo
+
+ ignore
+
+
+ false
+
+
+
+
+
+ maven-core-it
+ @baseurl@/repo
+
+ ignore
+
+
+ false
+
+
+
+
+
+
+ maven-core-it-repo
+
+