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 b6e8a98ac9..699de99f94 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
@@ -90,6 +90,7 @@ public class IntegrationTestSuite
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng3938MergePluginExecutionsTest.class );
suite.addTestSuite( MavenITmng3937MergedPluginExecutionGoalsTest.class );
suite.addTestSuite( MavenITmng3927PluginDefaultExecutionConfigTest.class );
suite.addTestSuite( MavenITmng3924XmlMarkupInterpolationTest.class );
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3938MergePluginExecutionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3938MergePluginExecutionsTest.java
new file mode 100644
index 0000000000..73efc11b73
--- /dev/null
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3938MergePluginExecutionsTest.java
@@ -0,0 +1,87 @@
+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;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a test set for MNG-3938.
+ *
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class MavenITmng3938MergePluginExecutionsTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng3938MergePluginExecutionsTest()
+ {
+ super( "(2.0.4,)" );
+ }
+
+ /**
+ * Test that plugin executions with the same id are merged during inheritance, especially executions using the
+ * default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults, when
+ * no is involved.
+ */
+ public void testitWithoutPluginManagement()
+ throws Exception
+ {
+ testitMNG3938( "test-1" );
+ }
+
+ /**
+ * Test that plugin executions with the same id are merged during inheritance, especially executions using the
+ * default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults, when
+ * is involved.
+ */
+ public void testitWithPluginManagement()
+ throws Exception
+ {
+ testitMNG3938( "test-2" );
+ }
+
+ private void testitMNG3938( String project )
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3938" );
+
+ Verifier verifier = new Verifier( new File( new File( testDir, project ), "sub" ).getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "target" );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ List lines = verifier.loadLines( "target/default.log", "UTF-8" );
+ assertEquals( Arrays.asList( new String[] { "child" } ), lines );
+
+ lines = verifier.loadLines( "target/non-default.log", "UTF-8" );
+ assertEquals( Arrays.asList( new String[] { "child" } ), lines );
+
+ verifier.assertFileNotPresent( "target/parent.log" );
+ }
+
+}
diff --git a/its/core-it-suite/src/test/resources/mng-3938/test-1/pom.xml b/its/core-it-suite/src/test/resources/mng-3938/test-1/pom.xml
new file mode 100644
index 0000000000..85dd1f1c0a
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-3938/test-1/pom.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng3938
+ parent
+ 0.1
+ pom
+
+ Maven Integration Test :: MNG-3938
+
+ Test that plugin executions with the same id are merged during inheritance, especially executions using the
+ default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults.
+
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-log-file
+ 2.1-SNAPSHOT
+
+
+
+ validate
+
+ log-string
+
+
+ target/parent.log
+ parent
+
+
+
+ non-default
+ validate
+
+ log-string
+
+
+ target/parent.log
+ parent
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-3938/test-1/sub/pom.xml b/its/core-it-suite/src/test/resources/mng-3938/test-1/sub/pom.xml
new file mode 100644
index 0000000000..6128d5be92
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-3938/test-1/sub/pom.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mng3938
+ parent
+ 0.1
+
+
+ child
+
+ Maven Integration Test :: MNG-3938
+
+ Test that plugin executions with the same id are merged during inheritance, especially executions using the
+ default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults.
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-log-file
+ 2.1-SNAPSHOT
+
+
+
+ default
+ validate
+
+ log-string
+
+
+ target/default.log
+ child
+
+
+
+ non-default
+ validate
+
+ log-string
+
+
+ target/non-default.log
+ child
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-3938/test-2/pom.xml b/its/core-it-suite/src/test/resources/mng-3938/test-2/pom.xml
new file mode 100644
index 0000000000..d612bc5c52
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-3938/test-2/pom.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mng3938
+ parent
+ 0.1
+ pom
+
+ Maven Integration Test :: MNG-3938
+
+ Test that plugin executions with the same id are merged during inheritance, especially executions using the
+ default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults.
+
+
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-log-file
+ 2.1-SNAPSHOT
+
+
+
+ validate
+
+ log-string
+
+
+ target/parent.log
+ parent
+
+
+
+ non-default
+ validate
+
+ log-string
+
+
+ target/parent.log
+ parent
+
+
+
+
+
+
+
+
diff --git a/its/core-it-suite/src/test/resources/mng-3938/test-2/sub/pom.xml b/its/core-it-suite/src/test/resources/mng-3938/test-2/sub/pom.xml
new file mode 100644
index 0000000000..6128d5be92
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mng-3938/test-2/sub/pom.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mng3938
+ parent
+ 0.1
+
+
+ child
+
+ Maven Integration Test :: MNG-3938
+
+ Test that plugin executions with the same id are merged during inheritance, especially executions using the
+ default id, regardless whether the id is given explicitly by the user or implicitly assumed from defaults.
+
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-log-file
+ 2.1-SNAPSHOT
+
+
+
+ default
+ validate
+
+ log-string
+
+
+ target/default.log
+ child
+
+
+
+ non-default
+ validate
+
+ log-string
+
+
+ target/non-default.log
+ child
+
+
+
+
+
+
+