本文整理汇总了Java中org.apache.maven.profiles.ProfileManager类的典型用法代码示例。如果您正苦于以下问题:Java ProfileManager类的具体用法?Java ProfileManager怎么用?Java ProfileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProfileManager类属于org.apache.maven.profiles包,在下文中一共展示了ProfileManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUpProject
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
private void setUpProject( File pomFile, AbstractMojo mojo )
throws Exception
{
MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
ArtifactRepositoryFactory artifactRepositoryFactory =
(ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy( true, "never", "never" );
String localRepoUrl = "file://" + System.getProperty( "user.home" ) + "/.m2/repository";
ArtifactRepository localRepository =
artifactRepositoryFactory.createArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout(),
policy, policy );
ProfileManager profileManager = new DefaultProfileManager( getContainer() );
MavenProject project = projectBuilder.buildWithDependencies( pomFile, localRepository, profileManager );
//this gets the classes for these tests of this mojo (exec plugin) onto the project classpath for the test
project.getBuild().setOutputDirectory( new File( "target/test-classes" ).getAbsolutePath() );
setVariableValueToObject( mojo, "project", project );
}
开发者ID:mojohaus,项目名称:webstart,代码行数:25,代码来源:AbstractJnlpMojoTest.java
示例2: findEffectiveReactor
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
/**
* Manually constructs an list of effective reactor projects by recursively
* searching parent and submodule projects. This allows the intention of the
* reactor to be preserved, as long as it is fully available on disk, even
* when building a submodule directly.
*
* @param defaultReactor Return value to use if a comprehensive list can not
* be discovered.
* @param baseProject {@link MavenProject} where invocation started.
* @return A list of MavenProjects that can be treated as though within the
* current reactor.
* @throws ProjectBuildingException
*/
public static List<MavenProject> findEffectiveReactor(
final List<MavenProject> defaultReactor, final MavenSession session,
final MavenProject baseProject, final MavenProjectBuilder projectBuilder,
final ArtifactRepository localRepository) throws ProjectBuildingException
{
final Set<MavenProject> reactor = new HashSet<MavenProject>();
final Set<MavenProject> visited = new HashSet<MavenProject>();
final ProfileManager profileManager = getProfileManager(session);
findEffectiveReactor(reactor, visited, baseProject, baseProject,
projectBuilder, localRepository, profileManager);
if (reactor.size() <= 1 || !reactor.contains(baseProject)) return defaultReactor;
return new ArrayList<MavenProject>(reactor);
}
开发者ID:scijava,项目名称:scijava-maven-plugin,代码行数:29,代码来源:DependencyUtils.java
示例3: buildWithDependencies
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
public MavenProject buildWithDependencies( File pom, ArtifactRepository localRepository,
ProfileManager profileManager, TransferListener transferListener )
throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException
{
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration();
configuration.setLocalRepository( localRepository );
configuration.setGlobalProfileManager( profileManager );
ProjectBuildingRequest request = injectSession( toRequest( configuration ) );
request.setResolveDependencies( true );
try
{
return projectBuilder.build( pom, request ).getProject();
}
catch ( ProjectBuildingException e )
{
throw transformError( e );
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:22,代码来源:DefaultMavenProjectBuilder.java
示例4: getLocalRoot
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
/**
* Finds the local root of the specified project.
*
* @param project The project to find the local root for.
* @param localRepository the local repo.
* @param globalProfileManager the global profile manager.
* @param logger The logger to log to.
* @return The local root (note this may be the project passed as an argument).
*/
public static MavenProject getLocalRoot( MavenProjectBuilder builder, MavenProject project,
ArtifactRepository localRepository, ProfileManager globalProfileManager,
Log logger )
{
logger.info( "Searching for local aggregator root..." );
while ( true )
{
final File parentDir = project.getBasedir().getParentFile();
if ( parentDir != null && parentDir.isDirectory() )
{
logger.debug( "Checking to see if " + parentDir + " is an aggregator parent" );
File parent = new File( parentDir, "pom.xml" );
if ( parent.isFile() )
{
try
{
final MavenProject parentProject =
builder.build( parent, localRepository, globalProfileManager );
if ( getAllChildModules( parentProject, logger ).contains( project.getBasedir().getName() ) )
{
logger.debug( parentDir + " is an aggregator parent" );
project = parentProject;
continue;
}
else
{
logger.debug( parentDir + " is not an aggregator parent" );
}
}
catch ( ProjectBuildingException e )
{
logger.warn( e );
}
}
}
logger.debug( "Local aggregation root is " + project.getBasedir() );
return project;
}
}
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:49,代码来源:PomHelper.java
示例5: getLocalRoot
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
/**
* Finds the local root of the specified project.
*
* @param project The project to find the local root for.
* @param localRepository the local repo.
* @param globalProfileManager the global profile manager.
* @param logger The logger to log to.
* @return The local root (note this may be the project passed as an argument).
*/
public static MavenProject getLocalRoot( MavenProjectBuilder builder, MavenProject project,
ArtifactRepository localRepository, ProfileManager globalProfileManager,
Log logger )
{
logger.info( "Searching for local aggregator root..." );
while ( true )
{
final File parentDir = project.getBasedir().getParentFile();
if ( parentDir.isDirectory() )
{
logger.debug( "Checking to see if " + parentDir + " is an aggregator parent" );
File parent = new File( parentDir, "pom.xml" );
if ( parent.isFile() )
{
try
{
final MavenProject parentProject =
builder.build( parent, localRepository, globalProfileManager );
if ( getAllChildModules( parentProject, logger ).contains( project.getBasedir().getName() ) )
{
logger.debug( parentDir + " is an aggregator parent" );
project = parentProject;
continue;
}
else
{
logger.debug( parentDir + " is not an aggregator parent" );
}
}
catch ( ProjectBuildingException e )
{
logger.warn( e );
}
}
}
logger.debug( "Local aggregation root is " + project.getBasedir() );
return project;
}
}
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:49,代码来源:PomHelper.java
示例6: getProfileManager
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
/**
* Convenience method to get the {@link ProfileManager} for a given
* {@link MavenSession}.
*/
@SuppressWarnings("deprecation")
private static ProfileManager getProfileManager(final MavenSession session) {
final PlexusContainer container = session.getContainer();
final Properties execution = session.getExecutionProperties();
return new DefaultProfileManager(container, execution);
}
开发者ID:scijava,项目名称:scijava-maven-plugin,代码行数:11,代码来源:DependencyUtils.java
示例7: build
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
public MavenProject build( File pom, ArtifactRepository localRepository, ProfileManager profileManager )
throws ProjectBuildingException
{
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration();
configuration.setLocalRepository( localRepository );
configuration.setGlobalProfileManager( profileManager );
return build( pom, configuration );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:10,代码来源:DefaultMavenProjectBuilder.java
示例8: buildStandaloneSuperProject
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
public MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository, ProfileManager profileManager )
throws ProjectBuildingException
{
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration();
configuration.setLocalRepository( localRepository );
configuration.setGlobalProfileManager( profileManager );
return buildStandaloneSuperProject( configuration );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:10,代码来源:DefaultMavenProjectBuilder.java
示例9: resolveProject
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
@NotNull
public MavenExecutionResult resolveProject(@NotNull final File file,
@NotNull final List<String> activeProfiles,
@NotNull final List<String> inactiveProfiles,
List<ResolutionListener> listeners) {
MavenExecutionRequest request = createRequest(file, activeProfiles, inactiveProfiles, Collections.<String>emptyList());
ProjectBuilderConfiguration config = request.getProjectBuilderConfiguration();
request.getGlobalProfileManager().loadSettingsProfiles(mySettings);
ProfileManager globalProfileManager = request.getGlobalProfileManager();
globalProfileManager.loadSettingsProfiles(request.getSettings());
List<Exception> exceptions = new ArrayList<Exception>();
MavenProject project = null;
try {
// copied from DefaultMavenProjectBuilder.buildWithDependencies
MavenProjectBuilder builder = getComponent(MavenProjectBuilder.class);
project = builder.build(new File(file.getPath()), config);
builder.calculateConcreteState(project, config, false);
// copied from DefaultLifecycleExecutor.execute
findExtensions(project);
// end copied from DefaultLifecycleExecutor.execute
Artifact projectArtifact = project.getArtifact();
Map managedVersions = project.getManagedVersionMap();
ArtifactMetadataSource metadataSource = getComponent(ArtifactMetadataSource.class);
project.setDependencyArtifacts(project.createArtifacts(getComponent(ArtifactFactory.class), null, null));
ArtifactResolver resolver = getComponent(ArtifactResolver.class);
ArtifactResolutionResult result = resolver
.resolveTransitively(project.getDependencyArtifacts(), projectArtifact, managedVersions, myLocalRepository,
project.getRemoteArtifactRepositories(), metadataSource, null, listeners);
project.setArtifacts(result.getArtifacts());
// end copied from DefaultMavenProjectBuilder.buildWithDependencies
}
catch (Exception e) {
return handleException(e);
}
return new MavenExecutionResult(project, exceptions);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:MavenEmbedder.java
示例10: createProfileManager
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
private ProfileManager createProfileManager(List<String> activeProfiles, List<String> inactiveProfiles, Properties executionProperties) {
ProfileManager profileManager = new DefaultProfileManager(getContainer(), executionProperties);
profileManager.explicitlyActivate(activeProfiles);
profileManager.explicitlyDeactivate(inactiveProfiles);
return profileManager;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:MavenEmbedder.java
示例11: getProfileManager
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
private ProfileManager getProfileManager() throws Exception {
return (ProfileManager) ReflectionUtils.getDeclaredFieldValue(embedder, "profileManager");
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:4,代码来源:CommandLineRunner.java
示例12: resolveProject
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
@NotNull
public MavenExecutionResult resolveProject(@NotNull final File file,
@NotNull final List<String> activeProfiles,
List<ResolutionListener> listeners) {
MavenExecutionRequest request = createRequest(file, activeProfiles, Collections.<String>emptyList(), Collections.<String>emptyList());
ProjectBuilderConfiguration config = request.getProjectBuilderConfiguration();
request.getGlobalProfileManager().loadSettingsProfiles(mySettings);
ProfileManager globalProfileManager = request.getGlobalProfileManager();
globalProfileManager.loadSettingsProfiles(request.getSettings());
List<Exception> exceptions = new ArrayList<Exception>();
MavenProject project = null;
try {
// copied from DefaultMavenProjectBuilder.buildWithDependencies
MavenProjectBuilder builder = getComponent(MavenProjectBuilder.class);
project = builder.build(new File(file.getPath()), config);
builder.calculateConcreteState(project, config, false);
// copied from DefaultLifecycleExecutor.execute
findExtensions(project);
// end copied from DefaultLifecycleExecutor.execute
Artifact projectArtifact = project.getArtifact();
Map managedVersions = project.getManagedVersionMap();
ArtifactMetadataSource metadataSource = getComponent(ArtifactMetadataSource.class);
project.setDependencyArtifacts(project.createArtifacts(getComponent(ArtifactFactory.class), null, null));
ArtifactResolver resolver = getComponent(ArtifactResolver.class);
ArtifactResolutionResult result = resolver
.resolveTransitively(project.getDependencyArtifacts(), projectArtifact, managedVersions, myLocalRepository,
project.getRemoteArtifactRepositories(), metadataSource, null, listeners);
project.setArtifacts(result.getArtifacts());
// end copied from DefaultMavenProjectBuilder.buildWithDependencies
}
catch (Exception e) {
return handleException(e);
}
return new MavenExecutionResult(project, exceptions);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:43,代码来源:MavenEmbedder.java
示例13: toRequest
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
private ProjectBuildingRequest toRequest( ProjectBuilderConfiguration configuration )
{
DefaultProjectBuildingRequest request = new DefaultProjectBuildingRequest();
request.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 );
request.setResolveDependencies( false );
request.setLocalRepository( configuration.getLocalRepository() );
request.setBuildStartTime( configuration.getBuildStartTime() );
request.setUserProperties( configuration.getUserProperties() );
request.setSystemProperties( configuration.getExecutionProperties() );
ProfileManager profileManager = configuration.getGlobalProfileManager();
if ( profileManager != null )
{
request.setActiveProfileIds( profileManager.getExplicitlyActivatedIds() );
request.setInactiveProfileIds( profileManager.getExplicitlyDeactivatedIds() );
}
else
{
/*
* MNG-4900: Hack to workaround deficiency of legacy API which makes it impossible for plugins to access the
* global profile manager which is required to build a POM like a CLI invocation does. Failure to consider
* the activated profiles can cause repo declarations to be lost which in turn will result in artifact
* resolution failures, in particular when using the enhanced local repo which guards access to local files
* based on the configured remote repos.
*/
MavenSession session = legacySupport.getSession();
if ( session != null )
{
MavenExecutionRequest req = session.getRequest();
if ( req != null )
{
request.setActiveProfileIds( req.getActiveProfiles() );
request.setInactiveProfileIds( req.getInactiveProfiles() );
}
}
}
return request;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:42,代码来源:DefaultMavenProjectBuilder.java
示例14: build
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
MavenProject build( File pom, ArtifactRepository localRepository, ProfileManager profileManager )
throws ProjectBuildingException;
开发者ID:gems-uff,项目名称:oceano,代码行数:3,代码来源:MavenProjectBuilder.java
示例15: buildStandaloneSuperProject
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository, ProfileManager profileManager )
throws ProjectBuildingException;
开发者ID:gems-uff,项目名称:oceano,代码行数:3,代码来源:MavenProjectBuilder.java
示例16: buildWithDependencies
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
MavenProject buildWithDependencies( File pom, ArtifactRepository localRepository,
ProfileManager globalProfileManager, TransferListener transferListener )
throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException;
开发者ID:gems-uff,项目名称:oceano,代码行数:4,代码来源:MavenProjectBuilder.java
示例17: setGlobalProfileManager
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
public ProjectBuilderConfiguration setGlobalProfileManager( ProfileManager globalProfileManager )
{
this.globalProfileManager = globalProfileManager;
return this;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:6,代码来源:DefaultProjectBuilderConfiguration.java
示例18: getGlobalProfileManager
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
public ProfileManager getGlobalProfileManager()
{
return globalProfileManager;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:5,代码来源:DefaultProjectBuilderConfiguration.java
示例19: testShouldNotActivateReversalOfPresentSystemProperty
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
public void testShouldNotActivateReversalOfPresentSystemProperty()
throws Exception
{
Profile syspropActivated = new Profile();
syspropActivated.setId( "syspropActivated" );
Activation syspropActivation = new Activation();
ActivationProperty syspropProperty = new ActivationProperty();
syspropProperty.setName( "!java.version" );
syspropActivation.setProperty( syspropProperty );
syspropActivated.setActivation( syspropActivation );
Properties props = System.getProperties();
ProfileManager profileManager = new DefaultProfileManager( getContainer(), props );
profileManager.addProfile( syspropActivated );
List active = profileManager.getActiveProfiles();
assertNotNull( active );
assertEquals( 0, active.size() );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:27,代码来源:DefaultProfileManagerTest.java
示例20: testShouldActivateDefaultProfile
import org.apache.maven.profiles.ProfileManager; //导入依赖的package包/类
public void testShouldActivateDefaultProfile()
throws Exception
{
Profile notActivated = new Profile();
notActivated.setId( "notActivated" );
Activation nonActivation = new Activation();
nonActivation.setJdk( "19.2" );
notActivated.setActivation( nonActivation );
Profile defaultActivated = new Profile();
defaultActivated.setId( "defaultActivated" );
Activation defaultActivation = new Activation();
defaultActivation.setActiveByDefault( true );
defaultActivated.setActivation( defaultActivation );
Properties props = System.getProperties();
ProfileManager profileManager = new DefaultProfileManager( getContainer(), props );
profileManager.addProfile( notActivated );
profileManager.addProfile( defaultActivated );
List active = profileManager.getActiveProfiles();
assertNotNull( active );
assertEquals( 1, active.size() );
assertEquals( "defaultActivated", ( (Profile) active.get( 0 ) ).getId() );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:35,代码来源:DefaultProfileManagerTest.java
注:本文中的org.apache.maven.profiles.ProfileManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论