From 68d8ce9d34a4f02eb23d738003f765d693b84722 Mon Sep 17 00:00:00 2001 From: Britton Isbell Date: Wed, 21 Jan 2009 07:35:33 +0000 Subject: [PATCH] MNG-3979. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@736252 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/project/builder/PomTransformer.java | 31 +++++++++++++++---- .../project/builder/PomConstructionTest.java | 8 ++--- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java b/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java index b0bf630e99..8cc61e8495 100644 --- a/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java +++ b/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java @@ -380,12 +380,31 @@ public class PomTransformer listener.fire(ds.queryFor(uri)); } } -// for(ModelProperty mp : props) { -// if(mp.getUri().startsWith(ProjectUri.Build.Plugins.Plugin.Executions.Execution.configuration)) { -// System.out.println(mp); -// } -// } - return factory.createDomainModel( props ); + + //Cleanup props (MNG-3979) + List p = new ArrayList(); + for(ModelProperty mp : props) + { + if(mp.getResolvedValue() != null + && mp.getResolvedValue().trim().equals("")) + { + int index = props.indexOf(mp) + 1; + + if(index <= props.size() && mp.isParentOf(props.get(index)) && !props.get(index).getUri().contains("#property")) + { + p.add(new ModelProperty(mp.getUri(), null)); + } + else + { + p.add(mp); + } + } + else + { + p.add(mp); + } + } + return factory.createDomainModel( p ); } private static List transformDependencyManagement( List modelProperties ) 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 6f310fdfa4..2e43d2bb47 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 @@ -166,7 +166,7 @@ public class PomConstructionTest assertEquals( 4, ( (List) pom.getValue( "build/plugins[1]/executions" ) ).size() ); } - /* FIXME: cf. MNG-3943*/ + /* MNG-3943*/ public void testMergeOfPluginExecutionsWhenChildAndParentUseDifferentPluginVersions() throws Exception { @@ -217,7 +217,7 @@ public class PomConstructionTest assertEquals( 1, ( (List) pom.getValue( "build/pluginManagement/plugins[1]/executions[1]/goals" ) ).size() ); } - /* FIXME: cf. MNG-3937*/ + /* MNG-3937*/ public void testOrderOfMergedPluginExecutionGoalsWithoutPluginManagement() throws Exception { @@ -252,7 +252,7 @@ public class PomConstructionTest assertEquals( "child-non-default", pom.getValue( "build/plugins[1]/executions[@id='non-default']/phase" ) ); } - /* FIXME: cf. MNG-3938 */ + /* MNG-3938 */ public void testOverridingOfInheritedPluginExecutionsWithPluginManagement() throws Exception { @@ -428,7 +428,7 @@ public class PomConstructionTest assertEquals( pom.getBasedir(), new File( pom.getValue( "properties/prop1" ).toString() ) ); } - /* FIXME: cf. MNG-3979 + /* MNG-3979 */ public void testJoiningOfContainersWhenChildHasEmptyElements() throws Exception {