diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index 3fc2ea8e01..da08d95454 100644 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -100,7 +100,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.TreeMap; /*:apt @@ -759,8 +758,6 @@ public class DefaultMavenProjectBuilder } } - mergeManagedDependencies(project.getModel(), localRepository, parentSearchRepositories); - try { project = processProjectLogic( pomLocation, project, externalProfileManager, projectDir, strict ); @@ -1110,66 +1107,6 @@ public class DefaultMavenProjectBuilder return result; } - private void mergeManagedDependencies(Model model, ArtifactRepository localRepository, List parentSearchRepositories) - throws ProjectBuildingException - { - DependencyManagement modelDepMgmt = model.getDependencyManagement(); - - if (modelDepMgmt != null) - { - Map depsMap = new TreeMap(); - Iterator iter = modelDepMgmt.getDependencies().iterator(); - boolean doInclude = false; - while (iter.hasNext()) - { - Dependency dep = (Dependency) iter.next(); - depsMap.put( dep.getManagementKey(), dep ); - if (dep.getType().equals("pom") && Artifact.SCOPE_IMPORT.equals(dep.getScope())) - { - doInclude = true; - } - } - Map newDeps = new TreeMap(depsMap); - iter = modelDepMgmt.getDependencies().iterator(); - if (doInclude) - { - while (iter.hasNext()) - { - Dependency dep = (Dependency)iter.next(); - if (dep.getType().equals("pom") && Artifact.SCOPE_IMPORT.equals(dep.getScope())) - { - Artifact artifact = artifactFactory.createProjectArtifact( dep.getGroupId(), dep.getArtifactId(), - dep.getVersion(), dep.getScope() ); - MavenProject project = buildFromRepository(artifact, parentSearchRepositories, localRepository, false); - - DependencyManagement depMgmt = project.getDependencyManagement(); - - if (depMgmt != null) - { - if ( getLogger().isDebugEnabled() ) - { - getLogger().debug( "Importing managed dependencies for " + dep.toString() ); - } - - for ( Iterator it = depMgmt.getDependencies().iterator(); it.hasNext(); ) - { - Dependency includedDep = (Dependency) it.next(); - String key = includedDep.getManagementKey(); - if (!newDeps.containsKey(key)) - { - newDeps.put( includedDep.getManagementKey(), includedDep ); - } - } - newDeps.remove(dep.getManagementKey()); - } - } - } - List deps = new ArrayList(newDeps.values()); - modelDepMgmt.setDependencies(deps); - } - } - } - private Model readModel( String projectId, File file, boolean strict ) diff --git a/maven-project/src/test/java/org/apache/maven/project/imports/AbstractProjectImportsTestCase.java b/maven-project/src/test/java/org/apache/maven/project/imports/AbstractProjectImportsTestCase.java deleted file mode 100644 index ec1fef53a2..0000000000 --- a/maven-project/src/test/java/org/apache/maven/project/imports/AbstractProjectImportsTestCase.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.apache.maven.project.imports; - -/* - * 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.project.AbstractMavenProjectTestCase; - -import java.io.File; - -/** - * @author Jason van Zyl - * @version $Id: AbstractProjectInheritanceTestCase.java 495147 2007-01-11 07:47:53Z jvanzyl $ - */ -public abstract class AbstractProjectImportsTestCase - extends AbstractMavenProjectTestCase -{ - protected String getTestSeries() - { - String className = getClass().getPackage().getName(); - - return className.substring( className.lastIndexOf( "." ) + 1 ); - } - - protected File projectFile( String name ) - { - return new File( getLocalRepositoryPath(), "/maven/poms/" + name + "-1.0.pom" ); - } - - // ---------------------------------------------------------------------- - // The local repository for this category of tests - // ---------------------------------------------------------------------- - - protected File getLocalRepositoryPath() - { - return getTestFile( "src/test/resources/imports-repo/" + getTestSeries() ); - } -} diff --git a/maven-project/src/test/java/org/apache/maven/project/imports/t01/ProjectImportsTest.java b/maven-project/src/test/java/org/apache/maven/project/imports/t01/ProjectImportsTest.java deleted file mode 100644 index 9695023e3b..0000000000 --- a/maven-project/src/test/java/org/apache/maven/project/imports/t01/ProjectImportsTest.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.apache.maven.project.imports.t01; - -/* - * 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.Map; - -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.imports.AbstractProjectImportsTestCase; -import org.apache.maven.artifact.Artifact; - - -/** - * Verifies managed dependencies are imported into other projects correctly. - * - * @version $Id: $ - */ -public class ProjectImportsTest extends AbstractProjectImportsTestCase -{ - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inhertis from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - public void testDependencyManagementImportsVersions() throws Exception - { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File( localRepo, "p0/pom.xml" ); - File pom0Basedir = pom0.getParentFile(); - System.out.println("basedir " + pom0Basedir.getAbsolutePath()); - File pom1 = new File( pom0Basedir, "p1/pom.xml" ); - File pom2 = new File( pom0Basedir, "p2/pom.xml" ); - File pom3 = new File( pom0Basedir, "p3/pom.xml" ); - File pom4 = new File( pom0Basedir, "p4/pom.xml" ); - getProjectWithDependencies( pom0 ); - - // load the child project, which inherits from p0... - // MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project1 = getProjectWithDependencies( pom1 ); - - assertEquals( pom0Basedir, project1.getParent().getBasedir() ); - - Map map = project1.getArtifactMap(); - assertNotNull("No artifacts", map); - assertTrue("No Artifacts", map.size() > 0); - assertTrue("Set size should be 2, is " + map.size(), map.size() == 2); - - Artifact a = (Artifact) map.get("maven-test:maven-test-a"); - Artifact b = (Artifact) map.get("maven-test:maven-test-b"); - - assertTrue("Incorrect version for " + a.getDependencyConflictId(), a.getVersion().equals("1.0")); - assertTrue("Incorrect version for " + b.getDependencyConflictId(), b.getVersion().equals("1.0")); - - // load the child project, which inherits from p0... - // MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project2 = getProjectWithDependencies( pom2 ); - - map = project2.getArtifactMap(); - assertNotNull("No artifacts", map); - assertTrue("No Artifacts", map.size() > 0); - assertTrue("Set size should be 3, is " + map.size(), map.size() == 3); - - a = (Artifact) map.get("maven-test:maven-test-a"); - b = (Artifact) map.get("maven-test:maven-test-b"); - Artifact c = (Artifact) map.get("maven-test:maven-test-c"); - - assertTrue("Incorrect version for " + a.getDependencyConflictId(), a.getVersion().equals("1.0")); - assertTrue("Incorrect version for " + b.getDependencyConflictId(), b.getVersion().equals("1.0")); - assertTrue("Incorrect version for " + c.getDependencyConflictId(), c.getVersion().equals("1.0")); - - // load the child project, which inherits from p0... - // MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project3 = getProjectWithDependencies( pom3 ); - - map = project3.getArtifactMap(); - assertNotNull("No artifacts", map); - assertTrue("No Artifacts", map.size() > 0); - assertTrue("Set size should be 3, is " + map.size(), map.size() == 3); - - a = (Artifact) map.get("maven-test:maven-test-a"); - c = (Artifact) map.get("maven-test:maven-test-c"); - Artifact d = (Artifact) map.get("maven-test:maven-test-d"); - - assertTrue("Incorrect version for " + a.getDependencyConflictId(), a.getVersion().equals("1.1")); - assertTrue("Incorrect version for " + c.getDependencyConflictId(), c.getVersion().equals("1.1")); - assertTrue("Incorrect version for " + d.getDependencyConflictId(), d.getVersion().equals("1.0")); - - // load the child project, which inherits from p0... - // MavenProject project0 = getProjectWithDependencies( pom0 ); - MavenProject project4 = getProjectWithDependencies( pom4 ); - - map = project4.getArtifactMap(); - assertNotNull("No artifacts", map); - assertTrue("No Artifacts", map.size() > 0); - assertTrue("Set size should be 4, is " + map.size(), map.size() == 4); - - a = (Artifact) map.get("maven-test:maven-test-a"); - b = (Artifact) map.get("maven-test:maven-test-b"); - c = (Artifact) map.get("maven-test:maven-test-c"); - d = (Artifact) map.get("maven-test:maven-test-d"); - - assertTrue("Incorrect version for " + a.getDependencyConflictId(), a.getVersion().equals("1.0")); - assertTrue("Incorrect version for " + b.getDependencyConflictId(), b.getVersion().equals("1.1")); - assertTrue("Incorrect version for " + c.getDependencyConflictId(), c.getVersion().equals("1.0")); - assertTrue("Incorrect version for " + d.getDependencyConflictId(), d.getVersion().equals("1.0")); - } -} \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-a-1.0.jar b/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-a-1.0.jar deleted file mode 100644 index 257cc5642c..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-a-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-a-1.1.jar b/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-a-1.1.jar deleted file mode 100644 index 257cc5642c..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-a-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-b-1.0.jar b/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-b-1.0.jar deleted file mode 100644 index 257cc5642c..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-b-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-b-1.1.jar b/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-b-1.1.jar deleted file mode 100644 index 257cc5642c..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-b-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-c-1.0.jar b/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-c-1.0.jar deleted file mode 100644 index 257cc5642c..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-c-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-c-1.1.jar b/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-c-1.1.jar deleted file mode 100644 index 257cc5642c..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-c-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-d-1.0.jar b/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-d-1.0.jar deleted file mode 100644 index 257cc5642c..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-d-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-d-1.1.jar b/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-d-1.1.jar deleted file mode 100644 index 257cc5642c..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-d-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-d-1.2.jar b/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-d-1.2.jar deleted file mode 100644 index 257cc5642c..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/jars/maven-test-d-1.2.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-a-1.0.pom b/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-a-1.0.pom deleted file mode 100644 index 93fc0d0b3e..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-a-1.0.pom +++ /dev/null @@ -1,14 +0,0 @@ - - 4.0.0 - maven-test - maven-test-a - jar - 1.0 - - - central - Fake Maven Central Repository - file://dummy - - - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-a-1.1.pom b/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-a-1.1.pom deleted file mode 100644 index a08308610b..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-a-1.1.pom +++ /dev/null @@ -1,14 +0,0 @@ - - 4.0.0 - maven-test - maven-test-a - jar - 1.1 - - - central - Fake Maven Central Repository - file://dummy - - - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-b-1.0.pom b/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-b-1.0.pom deleted file mode 100644 index c173c663de..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-b-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - maven-test-b - jar - 1.0 - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-b-1.1.pom b/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-b-1.1.pom deleted file mode 100644 index fff241a19b..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-b-1.1.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - maven-test-b - jar - 1.1 - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-c-1.0.pom b/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-c-1.0.pom deleted file mode 100644 index 1f0497860f..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-c-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - maven-test-c - jar - 1.0 - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-c-1.1.pom b/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-c-1.1.pom deleted file mode 100644 index 8bd52514ce..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-c-1.1.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - maven-test-c - jar - 1.1 - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-d-1.0.pom b/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-d-1.0.pom deleted file mode 100644 index ac6ef12ec5..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-d-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - maven-test-d - jar - 1.0 - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-d-1.1.pom b/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-d-1.1.pom deleted file mode 100644 index 6e22f6083e..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-d-1.1.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - maven-test-d - jar - 1.1 - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-d-1.2.pom b/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-d-1.2.pom deleted file mode 100644 index 16f8d90515..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/maven-test/poms/maven-test-d-1.2.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - maven-test-d - jar - 1.2 - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/p0/p1/pom.xml b/maven-project/src/test/resources/imports-repo/t01/p0/p1/pom.xml deleted file mode 100644 index 7bfca34249..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/p0/p1/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - p0 - maven - 1.0 - - 4.0.0 - maven - p1 - pom - p1 - 1.0 - - scm-url - - - - - maven-test - maven-test-b - 1.0 - - - - - - maven-test - maven-test-a - - - maven-test - maven-test-b - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/p0/p2/pom.xml b/maven-project/src/test/resources/imports-repo/t01/p0/p2/pom.xml deleted file mode 100644 index b45ce9c618..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/p0/p2/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - p0 - maven - 1.0 - - 4.0.0 - maven - p2 - pom - p2 - 1.0 - - scm-url - - - - - maven - p1 - 1.0 - pom - import - - - maven-test - maven-test-c - 1.0 - - - - - - maven-test - maven-test-a - - - maven-test - maven-test-b - - - maven-test - maven-test-c - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/p0/p3/pom.xml b/maven-project/src/test/resources/imports-repo/t01/p0/p3/pom.xml deleted file mode 100644 index e9648e393d..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/p0/p3/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - p0 - maven - 1.0 - - 4.0.0 - maven - p3 - pom - p3 - 1.0 - - scm-url - - - - - maven-test - maven-test-a - 1.1 - - - maven-test - maven-test-c - 1.1 - - - maven-test - maven-test-d - 1.0 - - - - - - maven-test - maven-test-a - - - maven-test - maven-test-c - - - maven-test - maven-test-d - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/p0/p4/pom.xml b/maven-project/src/test/resources/imports-repo/t01/p0/p4/pom.xml deleted file mode 100644 index 7ffef9d727..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/p0/p4/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - p0 - maven - 1.0 - - 4.0.0 - maven - p4 - pom - p4 - 1.0 - - scm-url - - - - - maven - p2 - 1.0 - pom - import - - - maven - p3 - 1.0 - pom - import - - - maven-test - maven-test-b - 1.1 - - - - - - maven-test - maven-test-a - - - maven-test - maven-test-b - - - maven-test - maven-test-c - - - maven-test - maven-test-d - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-project/src/test/resources/imports-repo/t01/p0/pom.xml b/maven-project/src/test/resources/imports-repo/t01/p0/pom.xml deleted file mode 100644 index 3ccf7e6336..0000000000 --- a/maven-project/src/test/resources/imports-repo/t01/p0/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - 4.0.0 - maven - p0 - pom - p0 - 1.0 - - Codehaus - - - - - maven-test - maven-test-a - 1.0 - - - - - p1 - p2 - p3 - p4 - - \ No newline at end of file