From e24f7564f728df3e332399f1a21ef770cdab9de8 Mon Sep 17 00:00:00 2001 From: Britton Isbell Date: Thu, 18 Dec 2008 23:35:31 +0000 Subject: [PATCH] Fix: there was a problem with pom construction if there were two or more plugins with dependencies elements. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@727855 13f79535-47bb-0310-9956-ffa450edef68 --- .../ArtifactModelContainerFactory.java | 7 ++-- .../project/builder/PomConstructionTest.java | 11 +++++++ .../single-test-poms/pluginDependencies.xml | 33 +++++++++++++++++++ 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 maven-project/src/test/resources-project-builder/single-test-poms/pluginDependencies.xml diff --git a/maven-project-builder/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java b/maven-project-builder/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java index 49196e4677..b045272b9e 100644 --- a/maven-project-builder/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java +++ b/maven-project-builder/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java @@ -38,10 +38,11 @@ public final class ArtifactModelContainerFactory ProjectUri.DependencyManagement.Dependencies.Dependency.xUri, ProjectUri.Dependencies.Dependency.xUri, ProjectUri.Reporting.Plugins.Plugin.xUri, ProjectUri.Build.PluginManagement.Plugins.Plugin.xUri, - ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.xUri, + //ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.xUri, - ProjectUri.Build.Plugins.Plugin.xUri, ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.xUri, - ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.Exclusions.Exclusion.xUri, + ProjectUri.Build.Plugins.Plugin.xUri, + //ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.xUri, + // ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.Exclusions.Exclusion.xUri, ProjectUri.Build.Extensions.Extension.xUri ) ); 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 3e2d099539..c5b1da3acc 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 @@ -67,6 +67,17 @@ public class PomConstructionTest assertModelEquals( tester, "child-descriptor", "build/plugins[1]/executions[1]/goals[1]" ); } + public void testTwoPluginsWithDependencies() + throws Exception + { + File pomFile = new File( testDirectory, "single-test-poms/pluginDependencies.xml" ); + PomArtifactResolver resolver = artifactResolver( "single-test-poms" ); + PomClassicDomainModel model = projectBuilder.buildModel( pomFile, null, resolver ); + PomTestWrapper pom = new PomTestWrapper( model ); + List dependencies = (List) pom.getValue( "build/plugins[1]/dependencies" ); + assertEquals( 1, dependencies.size() ); + } + private PomArtifactResolver artifactResolver( String basedir ) { PomArtifactResolver resolver = new FileBasedPomArtifactResolver( new File( BASE_POM_DIR, basedir ) ); diff --git a/maven-project/src/test/resources-project-builder/single-test-poms/pluginDependencies.xml b/maven-project/src/test/resources-project-builder/single-test-poms/pluginDependencies.xml new file mode 100644 index 0000000000..5a1bba6e07 --- /dev/null +++ b/maven-project/src/test/resources-project-builder/single-test-poms/pluginDependencies.xml @@ -0,0 +1,33 @@ + + 4.0.0 + org.sonatype.nexus + nexus-configuration + 1.0 + + + + org.codehaus.modello + modello-maven-plugin + + + commons-collections + commons-collections + 3.2 + + + + + org.sonatype.plugins + modello-plugin-upgrade + 0.0.1-SNAPSHOT + + + commons-collections + commons-collections + 3.2 + + + + + +