maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject maven git commit: added extensive urls inheritance unit tests, even for most tricky parts
Date Wed, 02 Sep 2015 02:36:10 GMT
Repository: maven
Updated Branches:
  refs/heads/master 6b6e9bf39 -> a2eb2fe3e


added extensive urls inheritance unit tests, even for most tricky parts

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

Branch: refs/heads/master
Commit: a2eb2fe3ee7b1362d3d43c07a0b47ff532dbdf37
Parents: 6b6e9bf
Author: Hervé Boutemy <hboutemy@apache.org>
Authored: Wed Sep 2 04:36:00 2015 +0200
Committer: Hervé Boutemy <hboutemy@apache.org>
Committed: Wed Sep 2 04:36:00 2015 +0200

----------------------------------------------------------------------
 .../DefaultInheritanceAssemblerTest.java        | 100 +++++++++++++++++--
 .../poms/inheritance/flat-urls-child.xml        |  34 +++++++
 .../poms/inheritance/flat-urls-expected.xml     |  50 ++++++++++
 .../poms/inheritance/flat-urls-parent.xml       |  49 +++++++++
 .../tricky-flat-artifactId-urls-child.xml       |  34 +++++++
 .../tricky-flat-artifactId-urls-expected.xml    |  50 ++++++++++
 .../tricky-flat-artifactId-urls-parent.xml      |  49 +++++++++
 .../tricky-flat-directory-urls-child.xml        |  34 +++++++
 .../tricky-flat-directory-urls-expected.xml     |  50 ++++++++++
 .../tricky-flat-directory-urls-parent.xml       |  49 +++++++++
 .../resources/poms/inheritance/urls-child.xml   |  34 +++++++
 .../poms/inheritance/urls-expected.xml          |  50 ++++++++++
 .../resources/poms/inheritance/urls-parent.xml  |  49 +++++++++
 13 files changed, 623 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
index f9e95ec..ae45283 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
@@ -28,6 +28,8 @@ import org.codehaus.plexus.PlexusTestCase;
 import org.custommonkey.xmlunit.XMLAssert;
 import org.custommonkey.xmlunit.XMLUnit;
 
+import junit.framework.AssertionFailedError;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -71,29 +73,109 @@ public class DefaultInheritanceAssemblerTest
     public void testPluginConfiguration()
         throws Exception
     {
-        Model parent = getModel( "plugin-configuration-parent" );
+        testInheritance( "plugin-configuration" );
+    }
+
+    /**
+     * Check most classical urls inheritance: directory structure where parent POM in parent
directory
+     * and child directory == artifatId
+     * @throws Exception
+     */
+    public void testUrls()
+        throws Exception
+    {
+        testInheritance( "urls" );
+    }
 
-        Model child = getModel( "plugin-configuration-child" );
+    /**
+     * Flat directory structure: parent & child POMs in sibling directories, child directory
== artifactId.
+     * @throws Exception
+     */
+    public void testFlatUrls()
+        throws Exception
+    {
+        testInheritance( "flat-urls" );
+    }
+
+    /**
+     * Tricky case: flat directory structure, but child directory != artifactId.
+     * Model interpolation does not give same result when calculated from build or from repo...
+     * This is why MNG-5000 fix in code is marked as bad practice (uses file names)
+     * @throws Exception
+     */
+    public void testFlatTrickyUrls()
+        throws Exception
+    {
+        // parent references child with artifactId (which is not directory name)
+        // then relative path calculation will fail during build from disk but success when
calculated from repo
+        try
+        {
+            // build from disk expected to fail
+            testInheritance( "tricky-flat-artifactId-urls", false );
+            fail( "should have failed since module reference == artifactId != directory name"
);
+        }
+        catch ( AssertionFailedError afe )
+        {
+            // expected failure: wrong relative path calculation
+            assertTrue( afe.getMessage().contains( "http://www.apache.org/path/to/parent/child-artifact-id/"
) );
+        }
+        // but ok from repo: local disk is ignored
+        testInheritance( "tricky-flat-artifactId-urls", true );
+
+        // parent references child with directory name (which is not artifact id)
+        // then relative path calculation will success during build from disk but failwhen
calculated from repo
+        testInheritance( "tricky-flat-directory-urls", false );
+        try
+        {
+            testInheritance( "tricky-flat-directory-urls", true );
+            fail( "should have failed since module reference == directory name != artifactId"
);
+        }
+        catch ( AssertionFailedError afe )
+        {
+            // expected failure
+            assertTrue( afe.getMessage().contains( "http://www.apache.org/path/to/parent/child-artifact-id/"
) );
+        }
+    }
+
+    public void testInheritance( String baseName )
+        throws Exception
+    {
+        testInheritance( baseName, false );
+        testInheritance( baseName, true );
+    }
+
+    public void testInheritance( String baseName, boolean fromRepo )
+        throws Exception
+    {
+        Model parent = getModel( baseName + "-parent" );
+
+        Model child = getModel( baseName + "-child" );
+
+        if ( fromRepo )
+        {
+            // when model is read from repo, a stream is used, then pomFile == null
+            // (has consequences in inheritance algorithm since getProjectDirectory() returns
null)
+            parent.setPomFile( null );
+            child.setPomFile( null );
+        }
 
         SimpleProblemCollector problems = new SimpleProblemCollector();
 
         assembler.assembleModelInheritance( child, parent, null, problems );
 
-        File actual = getTestFile( "target/test-classes/poms/inheritance/plugin-configuration-actual.xml"
);
-
+        // write baseName + "-actual"
+        File actual = getTestFile( "target/test-classes/poms/inheritance/" + baseName
+            + ( fromRepo ? "-build" : "-repo" ) + "-actual.xml" );
         writer.write( actual, null, child );
 
-        // check with getPom( "plugin-configuration-effective" )
-        File expected = getPom( "plugin-configuration-expected" );
+        // check with getPom( baseName + "-expected" )
+        File expected = getPom( baseName + "-expected" );
         try ( Reader control = new InputStreamReader( new FileInputStream( expected ), "UTF-8"
);
               Reader test = new InputStreamReader( new FileInputStream( actual ), "UTF-8"
) )
         {
-
             XMLUnit.setIgnoreComments( true );
             XMLUnit.setIgnoreWhitespace( true );
             XMLAssert.assertXMLEqual( control, test );
         }
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-child.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-child.xml b/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-child.xml
new file mode 100644
index 0000000..d7cc4d0
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-child.xml
@@ -0,0 +1,34 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>inheritance</groupId>
+    <artifactId>parent</artifactId>
+    <version>11-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>inheritance</artifactId><!-- same as directory name -->
+  <name>Model urls inheritance test child</name>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-expected.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-expected.xml
b/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-expected.xml
new file mode 100644
index 0000000..88fb1e2
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-expected.xml
@@ -0,0 +1,50 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>inheritance</groupId>
+    <artifactId>parent</artifactId>
+    <version>11-SNAPSHOT</version>
+  </parent>
+
+  <groupId>inheritance</groupId>
+  <artifactId>inheritance</artifactId>
+  <version>11-SNAPSHOT</version>
+  <name>Model urls inheritance test child</name>
+  <description>Flat directory structure case: module = ../child-artifact-id + child
directory path == child-artifact-id</description>
+
+  <!-- 5 inherited urls with ../${project.artifactId} added to parent -->
+  <url>http://www.apache.org/path/to/parent/../inheritance/</url>
+  <scm>
+    <connection>scm:my-scm:http://domain.org/base/../inheritance</connection>
+    <developerConnection>scm:my-scm:https://domain.org/base/../inheritance/</developerConnection>
+    <url>https://domain.org/base/../inheritance</url>
+  </scm>
+  <distributionManagement>
+    <site>
+      <url>scp://scp.domain.org/base/../inheritance/</url>
+    </site>
+  </distributionManagement>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-parent.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-parent.xml
b/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-parent.xml
new file mode 100644
index 0000000..3bf6ea8
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/flat-urls-parent.xml
@@ -0,0 +1,49 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>inheritance</groupId>
+  <artifactId>parent</artifactId>
+  <version>11-SNAPSHOT</version>
+
+  <name>Model urls inheritance test parent</name>
+  <description>Flat directory structure case: module = ../child-artifact-id + child
directory path == child-artifact-id</description>
+
+  <modules>
+    <module>../inheritance</module>
+  </modules>
+
+  <!-- 5 urls in the pom will be inherited with path added -->
+  <url>http://www.apache.org/path/to/parent/</url>
+  <scm>
+    <connection>scm:my-scm:http://domain.org/base</connection>
+    <developerConnection>scm:my-scm:https://domain.org/base/</developerConnection>
+    <url>https://domain.org/base</url>
+  </scm>
+  <distributionManagement>
+    <site>
+      <url>scp://scp.domain.org/base/</url>
+    </site>
+  </distributionManagement>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-child.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-child.xml
b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-child.xml
new file mode 100644
index 0000000..ac036af
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-child.xml
@@ -0,0 +1,34 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>inheritance</groupId>
+    <artifactId>parent</artifactId>
+    <version>11-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>child-artifact-id</artifactId>
+  <name>Model urls inheritance test child</name>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-expected.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-expected.xml
b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-expected.xml
new file mode 100644
index 0000000..f2a024e
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-expected.xml
@@ -0,0 +1,50 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>inheritance</groupId>
+    <artifactId>parent</artifactId>
+    <version>11-SNAPSHOT</version>
+  </parent>
+
+  <groupId>inheritance</groupId>
+  <artifactId>child-artifact-id</artifactId>
+  <version>11-SNAPSHOT</version>
+  <name>Model urls inheritance test child</name>
+  <description>Flat directory structure case: module = ../child-artifact-id + child
directory path != child-artifact-id</description>
+
+  <!-- 5 inherited urls with ../${project.artifactId} added to parent -->
+  <url>http://www.apache.org/path/to/parent/../child-artifact-id/</url>
+  <scm>
+    <connection>scm:my-scm:http://domain.org/base/../child-artifact-id</connection>
+    <developerConnection>scm:my-scm:https://domain.org/base/../child-artifact-id/</developerConnection>
+    <url>https://domain.org/base/../child-artifact-id</url>
+  </scm>
+  <distributionManagement>
+    <site>
+      <url>scp://scp.domain.org/base/../child-artifact-id/</url>
+    </site>
+  </distributionManagement>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-parent.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-parent.xml
b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-parent.xml
new file mode 100644
index 0000000..8a1d354
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-artifactId-urls-parent.xml
@@ -0,0 +1,49 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>inheritance</groupId>
+  <artifactId>parent</artifactId>
+  <version>11-SNAPSHOT</version>
+
+  <name>Model urls inheritance test parent</name>
+  <description>Flat directory structure case: module = ../child-artifact-id + child
directory path != child-artifact-id</description>
+
+  <modules>
+    <module>../child-artifact-id</module><!-- use child artifact id, even
if different from directory -->
+  </modules>
+
+  <!-- 5 urls in the pom will be inherited with path added -->
+  <url>http://www.apache.org/path/to/parent/</url>
+  <scm>
+    <connection>scm:my-scm:http://domain.org/base</connection>
+    <developerConnection>scm:my-scm:https://domain.org/base/</developerConnection>
+    <url>https://domain.org/base</url>
+  </scm>
+  <distributionManagement>
+    <site>
+      <url>scp://scp.domain.org/base/</url>
+    </site>
+  </distributionManagement>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-child.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-child.xml
b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-child.xml
new file mode 100644
index 0000000..ac036af
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-child.xml
@@ -0,0 +1,34 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>inheritance</groupId>
+    <artifactId>parent</artifactId>
+    <version>11-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>child-artifact-id</artifactId>
+  <name>Model urls inheritance test child</name>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-expected.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-expected.xml
b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-expected.xml
new file mode 100644
index 0000000..429ae38
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-expected.xml
@@ -0,0 +1,50 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>inheritance</groupId>
+    <artifactId>parent</artifactId>
+    <version>11-SNAPSHOT</version>
+  </parent>
+
+  <groupId>inheritance</groupId>
+  <artifactId>child-artifact-id</artifactId>
+  <version>11-SNAPSHOT</version>
+  <name>Model urls inheritance test child</name>
+  <description>Flat directory structure case: module = ../child directory path + child
directory path != child-artifact-id</description>
+
+  <!-- 5 inherited urls with ../${project.artifactId} added to parent -->
+  <url>http://www.apache.org/path/to/parent/../child-artifact-id/</url>
+  <scm>
+    <connection>scm:my-scm:http://domain.org/base/../child-artifact-id</connection>
+    <developerConnection>scm:my-scm:https://domain.org/base/../child-artifact-id/</developerConnection>
+    <url>https://domain.org/base/../child-artifact-id</url>
+  </scm>
+  <distributionManagement>
+    <site>
+      <url>scp://scp.domain.org/base/../child-artifact-id/</url>
+    </site>
+  </distributionManagement>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-parent.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-parent.xml
b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-parent.xml
new file mode 100644
index 0000000..211abbe
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/tricky-flat-directory-urls-parent.xml
@@ -0,0 +1,49 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>inheritance</groupId>
+  <artifactId>parent</artifactId>
+  <version>11-SNAPSHOT</version>
+
+  <name>Model urls inheritance test parent</name>
+  <description>Flat directory structure case: module = ../child directory path + child
directory path != child-artifact-id</description>
+
+  <modules>
+    <module>../inheritance</module><!-- current directory == inheritance -->
+  </modules>
+
+  <!-- 5 urls in the pom will be inherited with path added -->
+  <url>http://www.apache.org/path/to/parent/</url>
+  <scm>
+    <connection>scm:my-scm:http://domain.org/base</connection>
+    <developerConnection>scm:my-scm:https://domain.org/base/</developerConnection>
+    <url>https://domain.org/base</url>
+  </scm>
+  <distributionManagement>
+    <site>
+      <url>scp://scp.domain.org/base/</url>
+    </site>
+  </distributionManagement>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/urls-child.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/urls-child.xml b/maven-model-builder/src/test/resources/poms/inheritance/urls-child.xml
new file mode 100644
index 0000000..ac036af
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/urls-child.xml
@@ -0,0 +1,34 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>inheritance</groupId>
+    <artifactId>parent</artifactId>
+    <version>11-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>child-artifact-id</artifactId>
+  <name>Model urls inheritance test child</name>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/urls-expected.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/urls-expected.xml b/maven-model-builder/src/test/resources/poms/inheritance/urls-expected.xml
new file mode 100644
index 0000000..3370638
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/urls-expected.xml
@@ -0,0 +1,50 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>inheritance</groupId>
+    <artifactId>parent</artifactId>
+    <version>11-SNAPSHOT</version>
+  </parent>
+
+  <groupId>inheritance</groupId>
+  <artifactId>child-artifact-id</artifactId>
+  <version>11-SNAPSHOT</version>
+  <name>Model urls inheritance test child</name>
+  <description>Most classical case: child in direct subdirectory with directory name
== child artifactId</description>
+
+  <!-- 5 inherited urls with ${project.artifactId} added to parent -->
+  <url>http://www.apache.org/path/to/parent/child-artifact-id/</url>
+  <scm>
+    <connection>scm:my-scm:http://domain.org/base/child-artifact-id</connection>
+    <developerConnection>scm:my-scm:https://domain.org/base/child-artifact-id/</developerConnection>
+    <url>https://domain.org/base/child-artifact-id</url>
+  </scm>
+  <distributionManagement>
+    <site>
+      <url>scp://scp.domain.org/base/child-artifact-id/</url>
+    </site>
+  </distributionManagement>
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/a2eb2fe3/maven-model-builder/src/test/resources/poms/inheritance/urls-parent.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/urls-parent.xml b/maven-model-builder/src/test/resources/poms/inheritance/urls-parent.xml
new file mode 100644
index 0000000..cbe768a
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/urls-parent.xml
@@ -0,0 +1,49 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>inheritance</groupId>
+  <artifactId>parent</artifactId>
+  <version>11-SNAPSHOT</version>
+
+  <name>Model urls inheritance test parent</name>
+  <description>Most classical case: child in direct subdirectory with directory name
== child artifactId</description>
+
+  <modules>
+    <module>child-artifact-id</module>
+  </modules>
+
+  <!-- 5 urls in the pom will be inherited with path added -->
+  <url>http://www.apache.org/path/to/parent/</url>
+  <scm>
+    <connection>scm:my-scm:http://domain.org/base</connection>
+    <developerConnection>scm:my-scm:https://domain.org/base/</developerConnection>
+    <url>https://domain.org/base</url>
+  </scm>
+  <distributionManagement>
+    <site>
+      <url>scp://scp.domain.org/base/</url>
+    </site>
+  </distributionManagement>
+</project>
\ No newline at end of file


Mime
View raw message