mirror of https://github.com/apache/maven.git
o remove the profile manager and profile activation context from public view
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@775281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6fbd31302f
commit
01a13a3ffd
|
@ -25,8 +25,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.profiles.ProfileActivationContext;
|
||||
import org.apache.maven.profiles.ProfileManager;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.apache.maven.project.DefaultProjectBuilderConfiguration;
|
||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
||||
import org.apache.maven.settings.Settings;
|
||||
|
@ -52,7 +51,7 @@ public class DefaultMavenExecutionRequest
|
|||
|
||||
private List mirrors;
|
||||
|
||||
private List profiles;
|
||||
private List<Profile> profiles;
|
||||
|
||||
private List<String> pluginGroups = new ArrayList<String>();
|
||||
|
||||
|
@ -92,8 +91,6 @@ public class DefaultMavenExecutionRequest
|
|||
|
||||
private Properties properties;
|
||||
|
||||
private Properties userProperties;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private boolean showErrors = false;
|
||||
|
@ -110,8 +107,6 @@ public class DefaultMavenExecutionRequest
|
|||
|
||||
private boolean updateSnapshots = false;
|
||||
|
||||
private ProfileManager profileManager;
|
||||
|
||||
private List<ArtifactRepository> remoteRepositories;
|
||||
|
||||
/**
|
||||
|
@ -152,7 +147,6 @@ public class DefaultMavenExecutionRequest
|
|||
copy.setLoggingLevel( original.getLoggingLevel());
|
||||
copy.setGlobalChecksumPolicy( original.getGlobalChecksumPolicy());
|
||||
copy.setUpdateSnapshots( original.isUpdateSnapshots());
|
||||
copy.setProfileManager( original.getProfileManager() );
|
||||
copy.setRemoteRepositories( original.getRemoteRepositories() );
|
||||
copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
|
||||
return original;
|
||||
|
@ -364,13 +358,6 @@ public class DefaultMavenExecutionRequest
|
|||
|
||||
properties.setProperty( key, value );
|
||||
|
||||
if ( userProperties == null )
|
||||
{
|
||||
userProperties = new Properties();
|
||||
}
|
||||
|
||||
userProperties.setProperty( key, value );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -573,8 +560,6 @@ public class DefaultMavenExecutionRequest
|
|||
|
||||
private Settings settings;
|
||||
|
||||
private ProfileActivationContext profileActivationContext;
|
||||
|
||||
// calculated from request attributes.
|
||||
private ProjectBuilderConfiguration projectBuildingConfiguration;
|
||||
|
||||
|
@ -590,18 +575,6 @@ public class DefaultMavenExecutionRequest
|
|||
return settings;
|
||||
}
|
||||
|
||||
public ProfileManager getProfileManager()
|
||||
{
|
||||
return profileManager;
|
||||
}
|
||||
|
||||
public MavenExecutionRequest setProfileManager( ProfileManager profileManager )
|
||||
{
|
||||
this.profileManager = profileManager;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isProjectPresent()
|
||||
{
|
||||
return isProjectPresent;
|
||||
|
@ -669,28 +642,6 @@ public class DefaultMavenExecutionRequest
|
|||
return remoteRepositories;
|
||||
}
|
||||
|
||||
public ProfileActivationContext getProfileActivationContext()
|
||||
{
|
||||
return profileActivationContext;
|
||||
}
|
||||
|
||||
public MavenExecutionRequest setProfileActivationContext( ProfileActivationContext profileActivationContext )
|
||||
{
|
||||
this.profileActivationContext = profileActivationContext;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Properties getUserProperties()
|
||||
{
|
||||
return userProperties;
|
||||
}
|
||||
|
||||
public MavenExecutionRequest setUserProperties( Properties userProperties )
|
||||
{
|
||||
this.userProperties = userProperties;
|
||||
return this;
|
||||
}
|
||||
|
||||
//TODO: this does not belong here.
|
||||
public ProjectBuilderConfiguration getProjectBuildingConfiguration()
|
||||
{
|
||||
|
@ -699,7 +650,6 @@ public class DefaultMavenExecutionRequest
|
|||
projectBuildingConfiguration = new DefaultProjectBuilderConfiguration();
|
||||
projectBuildingConfiguration.setLocalRepository( getLocalRepository() );
|
||||
projectBuildingConfiguration.setExecutionProperties( getProperties() );
|
||||
projectBuildingConfiguration.setGlobalProfileManager( getProfileManager() );
|
||||
projectBuildingConfiguration.setRemoteRepositories( getRemoteRepositories() );
|
||||
projectBuildingConfiguration.setProcessPlugins( true );
|
||||
}
|
||||
|
@ -719,5 +669,11 @@ public class DefaultMavenExecutionRequest
|
|||
plugins = new HashSet<Plugin>();
|
||||
}
|
||||
return plugins;
|
||||
}
|
||||
}
|
||||
|
||||
public MavenExecutionRequest addProfile( Profile profile )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ import java.util.Set;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.profiles.ProfileActivationContext;
|
||||
import org.apache.maven.profiles.ProfileManager;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
||||
import org.apache.maven.settings.Settings;
|
||||
import org.apache.maven.wagon.events.TransferListener;
|
||||
|
@ -96,9 +95,6 @@ public interface MavenExecutionRequest
|
|||
MavenExecutionRequest setProperty( String key, String value );
|
||||
Properties getProperties();
|
||||
|
||||
MavenExecutionRequest setUserProperties( Properties userProperties );
|
||||
Properties getUserProperties();
|
||||
|
||||
// Reactor
|
||||
MavenExecutionRequest setReactorFailureBehavior( String failureBehavior );
|
||||
String getReactorFailureBehavior();
|
||||
|
@ -149,8 +145,9 @@ public interface MavenExecutionRequest
|
|||
boolean isOffline();
|
||||
|
||||
// Profiles
|
||||
List getProfiles();
|
||||
MavenExecutionRequest setProfiles( List profiles );
|
||||
List<Profile> getProfiles();
|
||||
MavenExecutionRequest addProfile( Profile profile );
|
||||
MavenExecutionRequest setProfiles( List<Profile> profiles );
|
||||
MavenExecutionRequest addActiveProfile( String profile );
|
||||
MavenExecutionRequest addActiveProfiles( List<String> profiles );
|
||||
List<String> getActiveProfiles();
|
||||
|
@ -182,12 +179,6 @@ public interface MavenExecutionRequest
|
|||
Settings getSettings();
|
||||
MavenExecutionRequest setSettings( Settings settings );
|
||||
|
||||
ProfileManager getProfileManager();
|
||||
MavenExecutionRequest setProfileManager( ProfileManager profileManager );
|
||||
|
||||
ProfileActivationContext getProfileActivationContext();
|
||||
MavenExecutionRequest setProfileActivationContext( ProfileActivationContext profileActivationContext );
|
||||
|
||||
boolean isProjectPresent();
|
||||
MavenExecutionRequest setProjectPresent( boolean isProjectPresent );
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.io.Reader;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.ArtifactUtils;
|
||||
|
@ -45,6 +44,7 @@ import org.apache.maven.model.lifecycle.LifecycleBindingsInjector;
|
|||
import org.apache.maven.model.normalization.Normalizer;
|
||||
import org.apache.maven.model.plugin.PluginConfigurationExpander;
|
||||
import org.apache.maven.profiles.DefaultProfileManager;
|
||||
import org.apache.maven.profiles.ProfileActivationContext;
|
||||
import org.apache.maven.profiles.ProfileActivationException;
|
||||
import org.apache.maven.profiles.ProfileManager;
|
||||
import org.apache.maven.profiles.ProfileManagerInfo;
|
||||
|
@ -116,9 +116,17 @@ public class DefaultMavenProjectBuilder
|
|||
|
||||
DomainModel domainModel;
|
||||
|
||||
ProfileActivationContext profileActivationContext = new ProfileActivationContext( configuration.getExecutionProperties(), true );
|
||||
profileActivationContext.setExplicitlyActiveProfileIds( configuration.getActiveProfileIds() );
|
||||
if (configuration.getExecutionProperties() != null )
|
||||
{
|
||||
profileActivationContext.getExecutionProperties().putAll( configuration.getExecutionProperties() );
|
||||
}
|
||||
ProfileManager profileManager = new DefaultProfileManager( profileActivationContext );
|
||||
|
||||
try
|
||||
{
|
||||
domainModel = build( "unknown", pomFile, configuration );
|
||||
domainModel = build( "unknown", pomFile, profileManager, configuration );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
@ -126,14 +134,20 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
|
||||
//Profiles
|
||||
//
|
||||
// Active profiles can be contributed to the MavenExecutionRequest as well as from the POM
|
||||
|
||||
List<Profile> projectProfiles;
|
||||
Properties props = new Properties();
|
||||
props.putAll( configuration.getExecutionProperties() );
|
||||
|
||||
try
|
||||
{
|
||||
projectProfiles = DefaultProfileManager.getActiveProfilesFrom( configuration.getGlobalProfileManager(), props, domainModel.getModel() );
|
||||
projectProfiles = new ArrayList<Profile>();
|
||||
profileManager.addProfiles( domainModel.getModel().getProfiles() );
|
||||
if ( configuration.getProfiles() != null )
|
||||
{
|
||||
profileManager.addProfiles( configuration.getProfiles() );
|
||||
}
|
||||
projectProfiles.addAll( profileManager.getActiveProfiles() );
|
||||
}
|
||||
catch ( ProfileActivationException e )
|
||||
{
|
||||
|
@ -234,8 +248,7 @@ public class DefaultMavenProjectBuilder
|
|||
throws ProjectBuildingException
|
||||
{
|
||||
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration()
|
||||
.setLocalRepository( localRepository )
|
||||
.setGlobalProfileManager( profileManager );
|
||||
.setLocalRepository( localRepository );
|
||||
|
||||
return build( project, configuration );
|
||||
}
|
||||
|
@ -351,15 +364,14 @@ public class DefaultMavenProjectBuilder
|
|||
return project;
|
||||
}
|
||||
|
||||
private DomainModel build( String projectId, File pomFile, ProjectBuilderConfiguration projectBuilderConfiguration )
|
||||
private DomainModel build( String projectId, File pomFile, ProfileManager profileManager, ProjectBuilderConfiguration projectBuilderConfiguration )
|
||||
throws ProjectBuildingException, IOException
|
||||
{
|
||||
List<String> activeProfileIds = ( projectBuilderConfiguration != null && projectBuilderConfiguration.getGlobalProfileManager() != null && projectBuilderConfiguration.getGlobalProfileManager()
|
||||
.getProfileActivationContext() != null ) ? projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyActiveProfileIds() : new ArrayList<String>();
|
||||
List<String> activeProfileIds = ( projectBuilderConfiguration != null && profileManager != null && profileManager.getProfileActivationContext() != null ) ? profileManager
|
||||
.getProfileActivationContext().getExplicitlyActiveProfileIds() : new ArrayList<String>();
|
||||
|
||||
List<String> inactiveProfileIds = ( projectBuilderConfiguration != null && projectBuilderConfiguration.getGlobalProfileManager() != null && projectBuilderConfiguration
|
||||
.getGlobalProfileManager().getProfileActivationContext() != null ) ? projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyInactiveProfileIds()
|
||||
: new ArrayList<String>();
|
||||
List<String> inactiveProfileIds = ( projectBuilderConfiguration != null && profileManager != null && profileManager.getProfileActivationContext() != null ) ? profileManager
|
||||
.getProfileActivationContext().getExplicitlyInactiveProfileIds() : new ArrayList<String>();
|
||||
|
||||
ProfileManagerInfo profileInfo = new ProfileManagerInfo( projectBuilderConfiguration.getExecutionProperties(), activeProfileIds, inactiveProfileIds );
|
||||
DomainModel domainModel = new DomainModel( pomFile );
|
||||
|
@ -588,8 +600,6 @@ public class DefaultMavenProjectBuilder
|
|||
parentFile = new File( parentFile.getAbsolutePath(), "pom.xml" );
|
||||
}
|
||||
|
||||
MavenProject topProject = projectBuilderConfiguration.getTopLevelProjectFromReactor();
|
||||
|
||||
DomainModel parentDomainModel = null;
|
||||
if ( !parentFile.isFile() )
|
||||
{
|
||||
|
|
|
@ -19,24 +19,22 @@ package org.apache.maven.project;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.model.ModelEventListener;
|
||||
import org.apache.maven.profiles.ProfileManager;
|
||||
import org.apache.maven.model.Profile;
|
||||
|
||||
public class DefaultProjectBuilderConfiguration
|
||||
implements ProjectBuilderConfiguration
|
||||
{
|
||||
private ProfileManager globalProfileManager;
|
||||
|
||||
private ArtifactRepository localRepository;
|
||||
|
||||
private List<ArtifactRepository> remoteRepositories;
|
||||
|
||||
//!!jvz Find out who added this. It's wrong, the execution properties are what come from the embedder setup not system properties.
|
||||
//jvz Find out who added this. It's wrong, the execution properties are what come from the embedder setup not system properties.
|
||||
private Properties executionProperties = System.getProperties();
|
||||
|
||||
private List<ModelEventListener> listeners;
|
||||
|
@ -45,6 +43,10 @@ public class DefaultProjectBuilderConfiguration
|
|||
|
||||
private boolean processPlugins = true;
|
||||
|
||||
private List<String> activeProfileIds;
|
||||
|
||||
private List<Profile> profiles;
|
||||
|
||||
public DefaultProjectBuilderConfiguration()
|
||||
{
|
||||
}
|
||||
|
@ -63,18 +65,7 @@ public class DefaultProjectBuilderConfiguration
|
|||
public void setTopLevelProjectForReactor(MavenProject mavenProject)
|
||||
{
|
||||
this.topProject = mavenProject;
|
||||
}
|
||||
|
||||
public ProjectBuilderConfiguration setGlobalProfileManager( ProfileManager globalProfileManager )
|
||||
{
|
||||
this.globalProfileManager = globalProfileManager;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProfileManager getGlobalProfileManager()
|
||||
{
|
||||
return globalProfileManager;
|
||||
}
|
||||
}
|
||||
|
||||
public ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository )
|
||||
{
|
||||
|
@ -130,4 +121,29 @@ public class DefaultProjectBuilderConfiguration
|
|||
this.processPlugins = processPlugins;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getActiveProfileIds()
|
||||
{
|
||||
return activeProfileIds;
|
||||
}
|
||||
|
||||
public void setActiveProfileIds( List<String> activeProfileIds )
|
||||
{
|
||||
this.activeProfileIds = activeProfileIds;
|
||||
}
|
||||
|
||||
public void addProfile( Profile profile )
|
||||
{
|
||||
if ( profiles == null )
|
||||
{
|
||||
profiles = new ArrayList<Profile>();
|
||||
}
|
||||
|
||||
profiles.add( profile );
|
||||
}
|
||||
|
||||
public List<Profile> getProfiles()
|
||||
{
|
||||
return profiles;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.apache.maven.profiles.ProfileManager;
|
||||
|
||||
public interface ProjectBuilderConfiguration
|
||||
|
@ -16,10 +17,6 @@ public interface ProjectBuilderConfiguration
|
|||
|
||||
List<ArtifactRepository> getRemoteRepositories();
|
||||
|
||||
ProjectBuilderConfiguration setGlobalProfileManager( ProfileManager globalProfileManager );
|
||||
|
||||
ProfileManager getGlobalProfileManager();
|
||||
|
||||
ProjectBuilderConfiguration setExecutionProperties( Properties executionProperties );
|
||||
|
||||
Properties getExecutionProperties();
|
||||
|
@ -31,5 +28,23 @@ public interface ProjectBuilderConfiguration
|
|||
ProjectBuilderConfiguration setProcessPlugins( boolean processPlugins );
|
||||
|
||||
boolean isProcessPlugins();
|
||||
|
||||
// Profiles
|
||||
|
||||
/**
|
||||
* Set any active profiles that the {@link MavenProjectBuilder} should consider while constructing
|
||||
* a {@link MavenProject}.
|
||||
*/
|
||||
void setActiveProfileIds( List<String> activeProfileIds );
|
||||
|
||||
List<String> getActiveProfileIds();
|
||||
|
||||
/**
|
||||
* Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom configuration
|
||||
* like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse.
|
||||
* @param profile
|
||||
*/
|
||||
void addProfile( Profile profile );
|
||||
|
||||
List<Profile> getProfiles();
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ public class MavenMetadataSource
|
|||
{
|
||||
Artifact dependencyArtifact;
|
||||
|
||||
//TODO: deal with this in a unified way, probably just looking at the dependency.
|
||||
if ( d.getClassifier() != null )
|
||||
{
|
||||
dependencyArtifact = repositorySystem.createArtifactWithClassifier( d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getType(), d.getClassifier() );
|
||||
|
|
|
@ -149,11 +149,10 @@ public abstract class AbstractMavenProjectTestCase
|
|||
Properties props = System.getProperties();
|
||||
ProfileActivationContext ctx = new ProfileActivationContext( props, false );
|
||||
|
||||
ProjectBuilderConfiguration pbc = new DefaultProjectBuilderConfiguration();
|
||||
pbc.setLocalRepository( getLocalRepository() );
|
||||
pbc.setGlobalProfileManager( new DefaultProfileManager( ctx ) );
|
||||
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration();
|
||||
configuration.setLocalRepository( getLocalRepository() );
|
||||
|
||||
return projectBuilder.build( pom, pbc );
|
||||
return projectBuilder.build( pom, configuration );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@ import java.util.Properties;
|
|||
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
|
||||
import org.apache.maven.profiles.DefaultProfileManager;
|
||||
import org.apache.maven.profiles.ProfileActivationContext;
|
||||
import org.apache.maven.project.harness.PomTestWrapper;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
|
@ -1462,21 +1460,9 @@ public class PomConstructionTest
|
|||
String localRepoUrl = System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
|
||||
localRepoUrl = "file://" + localRepoUrl;
|
||||
config.setLocalRepository( new DefaultArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout() ) );
|
||||
|
||||
ProfileActivationContext profileActivationContext = new ProfileActivationContext( null, true );
|
||||
config.setActiveProfileIds( Arrays.asList( profileIds ) );
|
||||
config.setExecutionProperties( executionProperties );
|
||||
|
||||
if ( profileIds != null )
|
||||
{
|
||||
profileActivationContext.setExplicitlyActiveProfileIds( Arrays.asList( profileIds ) );
|
||||
}
|
||||
|
||||
if ( executionProperties != null )
|
||||
{
|
||||
config.setExecutionProperties( executionProperties );
|
||||
}
|
||||
|
||||
config.setGlobalProfileManager( new DefaultProfileManager( profileActivationContext ) );
|
||||
|
||||
return new PomTestWrapper( pomFile, mavenProjectBuilder.build( pomFile, config ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.apache.maven.settings;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
|
@ -72,43 +73,26 @@ public class PomConstructionWithSettingsTest
|
|||
}
|
||||
|
||||
private PomTestWrapper buildPom( String pomPath )
|
||||
throws Exception
|
||||
throws Exception
|
||||
{
|
||||
File pomFile = new File( testDirectory + File.separator + pomPath , "pom.xml" );
|
||||
File settingsFile = new File( testDirectory + File.separator + pomPath, "settings.xml" );
|
||||
|
||||
File settingsFile = new File( testDirectory + File.separator + pomPath, "settings.xml" );
|
||||
Settings settings = readSettingsFile(settingsFile);
|
||||
|
||||
ProfileActivationContext pCtx = new ProfileActivationContext(null, true);
|
||||
ProfileManager profileManager = new DefaultProfileManager(pCtx);
|
||||
|
||||
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration();
|
||||
|
||||
for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
|
||||
{
|
||||
Profile profile = SettingsUtils.convertFromSettingsProfile( rawProfile );
|
||||
|
||||
profileManager.addProfile( profile );
|
||||
config.addProfile( profile );
|
||||
}
|
||||
|
||||
List<String> settingsActiveProfileIds = settings.getActiveProfiles();
|
||||
|
||||
if ( settingsActiveProfileIds != null )
|
||||
{
|
||||
for ( String profileId : settingsActiveProfileIds )
|
||||
{
|
||||
profileManager.getProfileActivationContext().setActive( profileId );
|
||||
}
|
||||
}
|
||||
|
||||
ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration();
|
||||
|
||||
String localRepoUrl =
|
||||
System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
|
||||
String localRepoUrl = System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
|
||||
localRepoUrl = "file://" + localRepoUrl;
|
||||
config.setLocalRepository( new DefaultArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout() ) );
|
||||
|
||||
config.setGlobalProfileManager(profileManager);
|
||||
|
||||
return new PomTestWrapper( pomFile, mavenProjectBuilder.build( pomFile, config ) );
|
||||
config.setActiveProfileIds( settings.getActiveProfiles() );
|
||||
|
||||
return new PomTestWrapper( pomFile, mavenProjectBuilder.build( pomFile, config ) );
|
||||
}
|
||||
|
||||
private static Settings readSettingsFile(File settingsFile)
|
||||
|
|
|
@ -237,7 +237,6 @@ public final class CLIRequestUtils
|
|||
.setBaseDirectory( baseDirectory )
|
||||
.setGoals( goals )
|
||||
.setProperties( executionProperties ) // optional
|
||||
.setUserProperties( userProperties ) // optional
|
||||
.setReactorFailureBehavior( reactorFailureBehaviour ) // default: fail fast
|
||||
.setRecursive( recursive ) // default: true
|
||||
.setShowErrors( showErrors ) // default: false
|
||||
|
|
|
@ -65,8 +65,6 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
public MavenExecutionRequest populateDefaults( MavenExecutionRequest request, Configuration configuration )
|
||||
throws MavenEmbedderException
|
||||
{
|
||||
executionProperties( request, configuration );
|
||||
|
||||
pom( request, configuration );
|
||||
|
||||
settings( request, configuration );
|
||||
|
@ -79,35 +77,6 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
|
||||
return request;
|
||||
}
|
||||
|
||||
private void executionProperties( MavenExecutionRequest request, Configuration configuration )
|
||||
{
|
||||
Properties requestProperties = request.getProperties();
|
||||
|
||||
if ( requestProperties == null )
|
||||
{
|
||||
requestProperties = configuration.getSystemProperties();
|
||||
if ( requestProperties == null )
|
||||
{
|
||||
requestProperties = System.getProperties();
|
||||
}
|
||||
|
||||
request.setProperties( requestProperties );
|
||||
}
|
||||
|
||||
Properties userProperties = request.getUserProperties();
|
||||
if ( userProperties != null )
|
||||
{
|
||||
for ( Iterator<?> it = userProperties.keySet().iterator(); it.hasNext(); )
|
||||
{
|
||||
String key = (String) it.next();
|
||||
if ( !requestProperties.containsKey( key ) )
|
||||
{
|
||||
requestProperties.setProperty( key, userProperties.getProperty( key ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pom( MavenExecutionRequest request, Configuration configuration )
|
||||
{
|
||||
|
|
|
@ -174,26 +174,6 @@ public class DefaultProfileManager
|
|||
}
|
||||
return allActive;
|
||||
}
|
||||
|
||||
public static List<Profile> getActiveProfilesFrom(ProfileManager globalProfileManager, Properties properties, Model model)
|
||||
throws ProfileActivationException
|
||||
{
|
||||
List<Profile> projectProfiles = new ArrayList<Profile>();
|
||||
|
||||
ProfileActivationContext profileActivationContext = (globalProfileManager == null) ? new ProfileActivationContext( new Properties(), false ):
|
||||
globalProfileManager.getProfileActivationContext();
|
||||
profileActivationContext.getExecutionProperties().putAll(properties);
|
||||
|
||||
if(globalProfileManager != null)
|
||||
{
|
||||
projectProfiles.addAll( globalProfileManager.getActiveProfiles() );
|
||||
}
|
||||
|
||||
ProfileManager profileManager = new DefaultProfileManager( profileActivationContext );
|
||||
profileManager.addProfiles( model.getProfiles() );
|
||||
projectProfiles.addAll( profileManager.getActiveProfiles() );
|
||||
return projectProfiles;
|
||||
}
|
||||
|
||||
public static Collection<Profile> getActiveProfiles(List<Profile> profiles, ProfileManagerInfo profileContextInfo)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ public interface ProfileManager
|
|||
void addProfiles( List<Profile> profiles );
|
||||
|
||||
Map<String, Profile> getProfilesById();
|
||||
|
||||
|
||||
@Deprecated
|
||||
List<Profile> getActiveProfiles( Model model )
|
||||
throws ProfileActivationException;
|
||||
|
|
Loading…
Reference in New Issue