diff --git a/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java b/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java index 574133db28..2405a19292 100644 --- a/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java +++ b/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java @@ -320,6 +320,22 @@ public class PomConstructionTest assertEquals( "http://parent.url/download", pom.getValue( "distributionManagement/downloadUrl" ) ); } + public void testNonInheritedElementsInSubtreesOverriddenByChild() + throws Exception + { + PomTestWrapper pom = buildPom( "limited-inheritance/child" ); + assertEquals( null, pom.getValue( "organization/url" ) ); + assertEquals( null, pom.getValue( "issueManagement/system" ) ); + assertEquals( 0, ( (List) pom.getValue( "ciManagement/notifiers" ) ).size() ); + assertEquals( null, pom.getValue( "distributionManagement/repository/name" ) ); + assertEquals( true, pom.getValue( "distributionManagement/repository/uniqueVersion" ) ); + assertEquals( "default", pom.getValue( "distributionManagement/repository/layout" ) ); + assertEquals( null, pom.getValue( "distributionManagement/snapshotRepository/name" ) ); + assertEquals( true, pom.getValue( "distributionManagement/snapshotRepository/uniqueVersion" ) ); + assertEquals( "default", pom.getValue( "distributionManagement/snapshotRepository/layout" ) ); + assertEquals( null, pom.getValue( "distributionManagement/site/name" ) ); + } + private PomArtifactResolver artifactResolver( String basedir ) { return new FileBasedPomArtifactResolver( new File( BASE_POM_DIR, basedir ) ); diff --git a/maven-project/src/test/resources-project-builder/limited-inheritance/child/pom.xml b/maven-project/src/test/resources-project-builder/limited-inheritance/child/pom.xml new file mode 100644 index 0000000000..8e9e62376a --- /dev/null +++ b/maven-project/src/test/resources-project-builder/limited-inheritance/child/pom.xml @@ -0,0 +1,61 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng3845 + parent + 0.1 + + + child + + + child-org + + + + https://child.url/scm + + + http://child.url/issues + + + child-ci + http://child.url/ci + + + + child-distros + ssh://child.url/distros + + + child-snaps + ssh://child.url/snaps + + + child-site + scp://child.url/site + + + diff --git a/maven-project/src/test/resources-project-builder/limited-inheritance/pom.xml b/maven-project/src/test/resources-project-builder/limited-inheritance/pom.xml new file mode 100644 index 0000000000..bd7b4588a0 --- /dev/null +++ b/maven-project/src/test/resources-project-builder/limited-inheritance/pom.xml @@ -0,0 +1,87 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3845 + parent + 0.1 + pom + + Maven Integration Test :: MNG-3845 + + Test that inheritance is all-or-nothing for certain sub-trees of the POM. + + + + parent-org + http://parent.url/org + + + + http://parent.url/viewvc + http://parent.url/scm + https://parent.url/scm + parent-tag + + + parent-issues + http://parent.url/issues + + + parent-ci + http://parent.url/ci + + + irc + true + true + false + false + +
irc://parent.url/#ci
+
+
+
+
+ + + parent-distros + parent-distros + ssh://parent.url/distros + false + legacy + + + parent-snaps + parent-snaps + ssh://parent.url/snaps + false + legacy + + + parent-site + parent-site + scp://parent.url/site + + +