From 253cb012bcd7637fb3fcc62eae3c7d2b926239a4 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sat, 14 Mar 2009 17:59:31 +0000 Subject: [PATCH] o Reused util method git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@754502 13f79535-47bb-0310-9956-ffa450edef68 --- .../project/DefaultMavenProjectBuilder.java | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) 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 837c693ed2..f01614861c 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 @@ -59,7 +59,6 @@ import org.apache.maven.project.builder.PomInterpolatorTag; import org.apache.maven.project.builder.PomTransformer; import org.apache.maven.project.builder.ProjectUri; import org.apache.maven.project.builder.profile.ProfileContext; -import org.apache.maven.project.processor.ProcessorContext; import org.apache.maven.project.validation.ModelValidationResult; import org.apache.maven.project.validation.ModelValidator; import org.apache.maven.repository.RepositorySystem; @@ -751,6 +750,7 @@ public class DefaultMavenProjectBuilder throws IOException { List domainModels = new ArrayList(); + Collection profileContainers = profileContext.getActiveProfiles(); for ( ModelContainer mc : profileContainers ) @@ -759,15 +759,18 @@ public class DefaultMavenProjectBuilder transformed.add( new ModelProperty( ProjectUri.xUri, null ) ); for ( ModelProperty mp : mc.getProperties() ) { - if ( mp.getUri().startsWith( ProjectUri.Profiles.Profile.xUri ) && !mp.getUri().equals( ProjectUri.Profiles.Profile.id ) + if ( mp.getUri().startsWith( ProjectUri.Profiles.Profile.xUri ) + && !mp.getUri().equals( ProjectUri.Profiles.Profile.id ) && !mp.getUri().startsWith( ProjectUri.Profiles.Profile.Activation.xUri ) ) { - transformed.add( new ModelProperty( mp.getUri().replace( ProjectUri.Profiles.Profile.xUri, ProjectUri.xUri ), mp.getResolvedValue() ) ); + transformed.add( new ModelProperty( mp.getUri().replace( ProjectUri.Profiles.Profile.xUri, + ProjectUri.xUri ), mp.getResolvedValue() ) ); } } - + domainModels.add( new PomClassicDomainModel( transformed ) ); } + return domainModels; } @@ -811,22 +814,7 @@ public class DefaultMavenProjectBuilder //Process Profiles ProfileContext profileContext = new ProfileContext( new DefaultModelDataSource( parentDomainModel.getModelProperties(), PomTransformer.MODEL_CONTAINER_FACTORIES ), activeProfileIds, inactiveProfileIds, properties ); - Collection profileContainers = profileContext.getActiveProfiles(); - - for ( ModelContainer mc : profileContainers ) - { - List transformed = new ArrayList(); - transformed.add( new ModelProperty( ProjectUri.xUri, null ) ); - for ( ModelProperty mp : mc.getProperties() ) - { - if ( mp.getUri().startsWith( ProjectUri.Profiles.Profile.xUri ) && !mp.getUri().equals( ProjectUri.Profiles.Profile.id ) - && !mp.getUri().startsWith( ProjectUri.Profiles.Profile.Activation.xUri ) ) - { - transformed.add( new ModelProperty( mp.getUri().replace( ProjectUri.Profiles.Profile.xUri, ProjectUri.xUri ), mp.getResolvedValue() ) ); - } - } - domainModels.add( new PomClassicDomainModel( transformed ) ); - } + domainModels.addAll( transformProfiles( profileContext ) ); if ( !parentDomainModel.matchesParentOf( domainModel ) ) {