From 84534b4372dfa7f18f46af8df7c9667971a720ac Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Mon, 7 Sep 2009 11:11:24 +0000 Subject: [PATCH] o Fixed population of properties in legacy project builder git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@812081 13f79535-47bb-0310-9956-ffa450edef68 --- .../project/DefaultMavenProjectBuilder.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 e2c4917326..e611788c48 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 @@ -23,8 +23,10 @@ import java.util.List; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.InvalidRepositoryException; import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Repository; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.plugin.LegacySupport; import org.apache.maven.profiles.ProfileManager; import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.component.annotations.Component; @@ -44,6 +46,9 @@ public class DefaultMavenProjectBuilder @Requirement private RepositorySystem repositorySystem; + @Requirement + private LegacySupport legacySupport; + // ---------------------------------------------------------------------- // MavenProjectBuilder Implementation // ---------------------------------------------------------------------- @@ -133,7 +138,18 @@ public class DefaultMavenProjectBuilder .setRemoteRepositories( remoteRepositories ); configuration.setProcessPlugins( false ); configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); - + + MavenSession session = legacySupport.getSession(); + if ( session != null ) + { + configuration.setSystemProperties( session.getSystemProperties() ); + configuration.setUserProperties( session.getUserProperties() ); + } + else + { + configuration.setSystemProperties( System.getProperties() ); + } + return buildFromRepository( artifact, configuration ); }