From 503cc60cc52c8c03d4e1fa7d2194d044014c63b1 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Thu, 21 May 2009 20:34:33 +0000 Subject: [PATCH] o Fixed explicit profile deactivation git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@777246 13f79535-47bb-0310-9956-ffa450edef68 --- .../execution/DefaultMavenExecutionRequest.java | 1 + .../maven/project/DefaultMavenProjectBuilder.java | 8 +++----- .../project/DefaultProjectBuilderConfiguration.java | 12 ++++++++++++ .../maven/project/ProjectBuilderConfiguration.java | 4 ++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index 7ba64ac74b..2180352580 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -715,6 +715,7 @@ public class DefaultMavenExecutionRequest projectBuildingConfiguration.setExecutionProperties( getProperties() ); projectBuildingConfiguration.setRemoteRepositories( getRemoteRepositories() ); projectBuildingConfiguration.setActiveProfileIds( getActiveProfiles() ); + projectBuildingConfiguration.setInactiveProfileIds( getInactiveProfiles() ); projectBuildingConfiguration.setProfiles( getProfiles() ); projectBuildingConfiguration.setProcessPlugins( true ); } diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index 070d39a091..544ec37b14 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -120,10 +120,8 @@ public class DefaultMavenProjectBuilder ProfileActivationContext profileActivationContext = new ProfileActivationContext( configuration.getExecutionProperties(), true ); profileActivationContext.setExplicitlyActiveProfileIds( configuration.getActiveProfileIds() ); - if (configuration.getExecutionProperties() != null ) - { - profileActivationContext.getExecutionProperties().putAll( configuration.getExecutionProperties() ); - } + profileActivationContext.setExplicitlyInactiveProfileIds( configuration.getInactiveProfileIds() ); + ProfileManager profileManager = new DefaultProfileManager( profileActivationContext ); try @@ -483,7 +481,7 @@ public class DefaultMavenProjectBuilder if ( validationResult.getMessageCount() > 0 ) { - for ( String s : (List) validationResult.getMessages() ) + for ( String s : validationResult.getMessages() ) { logger.error( s ); } diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java index 201224d502..baa40433d2 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java @@ -44,6 +44,8 @@ public class DefaultProjectBuilderConfiguration private List activeProfileIds; + private List inactiveProfileIds; + private List profiles; public MavenProject getTopLevelProjectFromReactor() @@ -121,6 +123,16 @@ public class DefaultProjectBuilderConfiguration this.activeProfileIds = activeProfileIds; } + public List getInactiveProfileIds() + { + return inactiveProfileIds; + } + + public void setInactiveProfileIds( List inactiveProfileIds ) + { + this.inactiveProfileIds = inactiveProfileIds; + } + public void setProfiles( List profiles ) { this.profiles = profiles; diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java b/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java index be8d3d1d5d..e00f2daaf8 100644 --- a/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java +++ b/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java @@ -37,6 +37,10 @@ public interface ProjectBuilderConfiguration void setActiveProfileIds( List activeProfileIds ); List getActiveProfileIds(); + + void setInactiveProfileIds( List inactiveProfileIds ); + + List getInactiveProfileIds(); /** * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom configuration