From 1c35174120c73a0d1b8ae2ab213340f6d122e623 Mon Sep 17 00:00:00 2001 From: Britton Isbell Date: Mon, 23 Mar 2009 18:35:53 +0000 Subject: [PATCH] [MNG-2309] - Profile activation order. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@757491 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/project/processor/ProcessorContext.java | 5 +++-- .../org/apache/maven/project/PomConstructionTest.java | 11 ++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/maven-project/src/main/java/org/apache/maven/project/processor/ProcessorContext.java b/maven-project/src/main/java/org/apache/maven/project/processor/ProcessorContext.java index 886b3d565c..eb782295e1 100644 --- a/maven-project/src/main/java/org/apache/maven/project/processor/ProcessorContext.java +++ b/maven-project/src/main/java/org/apache/maven/project/processor/ProcessorContext.java @@ -74,12 +74,13 @@ public class ProcessorContext public static PomClassicDomainModel mergeProfilesIntoModel(Collection profiles, Model model, boolean isMostSpecialized) throws IOException { List profileModels = new ArrayList(); - profileModels.add( model ); + for(Profile profile : profiles) { profileModels.add( attachProfileNodesToModel(profile) ); } - + Collections.reverse( profileModels ); + profileModels.add( 0, model ); List processors = Arrays.asList( (Processor) new BuildProcessor( new ArrayList() ), (Processor) new ProfilesModuleProcessor(), new ProfilePropertiesProcessor(), new ParentProcessor(), diff --git a/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java b/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java index a9a2a38698..bfa30e0582 100644 --- a/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java +++ b/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java @@ -121,7 +121,6 @@ public class PomConstructionTest throws Exception { PomTestWrapper pom = buildPomFromMavenProject( "profile-properties-interpolation", "interpolation-profile" ); - System.out.println(pom.getDomainModel().asString()); assertEquals("PASSED", pom.getValue("properties[1]/test")); assertEquals("PASSED", pom.getValue("properties[1]/property")); } @@ -418,7 +417,6 @@ public class PomConstructionTest throws Exception { PomTestWrapper pom = buildPom( "merged-plugin-exec-order/wo-plugin-mngt/sub" ); - System.out.println(pom.getDomainModel().asString()); assertEquals( 5, ( (List) pom.getValue( "build/plugins[1]/executions" ) ).size() ); assertEquals( "parent-1", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) ); assertEquals( "parent-2", pom.getValue( "build/plugins[1]/executions[2]/goals[1]" ) ); @@ -431,7 +429,6 @@ public class PomConstructionTest throws Exception { PomTestWrapper pom = buildPom( "merged-plugin-exec-order/w-plugin-mngt/sub" ); - System.out.println(pom.getDomainModel().asString()); assertEquals( 5, ( (List) pom.getValue( "build/plugins[1]/executions" ) ).size() ); assertEquals( "parent-1", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) ); assertEquals( "parent-2", pom.getValue( "build/plugins[1]/executions[2]/goals[1]" ) ); @@ -454,7 +451,7 @@ public class PomConstructionTest throws Exception { PomTestWrapper pom = buildPom( "merged-plugin-exec-goals-order/wo-plugin-mngt/sub" ); - System.out.println(pom.getDomainModel().asString()); + assertEquals( 5, ( (List) pom.getValue( "build/plugins[1]/executions[1]/goals" ) ).size() ); assertEquals( "child-a", pom.getValue( "build/plugins[1]/executions[1]/goals[1]" ) ); assertEquals( "merged", pom.getValue( "build/plugins[1]/executions[1]/goals[2]" ) ); @@ -749,7 +746,7 @@ public class PomConstructionTest throws Exception { PomTestWrapper pom = buildPom( "plugin-config-merging/child" ); - System.out.println(pom.getDomainModel().asString()); + String prefix = "build/plugins[1]/configuration/"; assertEquals( "PASSED", pom.getValue( prefix + "propertiesFile" ) ); assertEquals( "PASSED", pom.getValue( prefix + "parent" ) ); @@ -1170,13 +1167,13 @@ public class PomConstructionTest assertEquals( "run", pom.getValue( "reporting/plugins[1]/reportSets[1]/reports[1]" ) ); } - /* FIXME: MNG-2309 + /* FIXME: MNG-2309*/ public void testProfileInjectionOrder() throws Exception { PomTestWrapper pom = buildPomFromMavenProject( "profile-injection-order", "pom-a", "pom-b", "pom-e", "pom-c", "pom-d" ); - + assertEquals( "e", pom.getValue( "properties[1]/pomProperty" ) ); } //*/