From 5888994149fc27547ed92ff58c4823faeb17ca9f Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Tue, 27 Jan 2009 16:18:32 +0000 Subject: [PATCH] [MNG-3853] [regression] Distribution Management injected by profile is not reflected by MavenProject git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@738128 13f79535-47bb-0310-9956-ffa450edef68 --- .../project/DefaultMavenProjectBuilder.java | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 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 664236697c..db65634feb 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 @@ -23,9 +23,7 @@ import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -309,6 +307,17 @@ public class DefaultMavenProjectBuilder profileActivationContext = new DefaultProfileActivationContext( config.getExecutionProperties(), false ); } + List projectProfiles = new ArrayList(); + + projectProfiles.addAll( profileAdvisor.applyActivatedProfiles( model, + isReactorProject ? projectDescriptor : null, + isReactorProject, profileActivationContext ) ); + + projectProfiles.addAll( profileAdvisor.applyActivatedExternalProfiles( model, + isReactorProject ? projectDescriptor + : null, + externalProfileManager ) ); + MavenProject project; try @@ -328,35 +337,9 @@ public class DefaultMavenProjectBuilder { throw new InvalidProjectModelException( projectId, e.getMessage(), projectDescriptor, e ); } - - List projectProfiles = new ArrayList(); - - projectProfiles.addAll( profileAdvisor.applyActivatedProfiles( project.getModel(), - isReactorProject ? projectDescriptor : null, - isReactorProject, profileActivationContext ) ); - - projectProfiles.addAll( profileAdvisor.applyActivatedExternalProfiles( project.getModel(), project.getFile(), externalProfileManager ) ); project.setActiveProfiles( projectProfiles ); - try - { - LinkedHashSet repoSet = new LinkedHashSet(); - if ( ( model.getRepositories() != null ) && !model.getRepositories().isEmpty() ) - { - repoSet.addAll( model.getRepositories() ); - } - if ( ( model.getPluginRepositories() != null ) && !model.getPluginRepositories().isEmpty() ) - { - repoSet.addAll( model.getPluginRepositories() ); - } - - project.setRemoteArtifactRepositories( mavenTools.buildArtifactRepositories( new ArrayList( repoSet ) ) ); - } - catch ( Exception e ) - { - e.printStackTrace(); - } return project; }