mirror of https://github.com/apache/maven.git
o renaming the embedder request to embedder configuration which is more appropropriate
o move toward using one constructor which takes a configuration for session wide configuration, the execution still takes an execution request as per usual git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@505664 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
17817ccc00
commit
1ff7c5a235
|
@ -27,7 +27,7 @@
|
||||||
<artifactId>maven-embedder</artifactId>
|
<artifactId>maven-embedder</artifactId>
|
||||||
<name>Maven Embedder</name>
|
<name>Maven Embedder</name>
|
||||||
<properties>
|
<properties>
|
||||||
<bundleVersion>2.1.0.v20070209-2050</bundleVersion>
|
<bundleVersion>2.1.0.v20070209-2105</bundleVersion>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -25,12 +25,12 @@ import org.apache.maven.settings.Settings;
|
||||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation of MavenEmbedRequest intefrace.
|
* Default implementation of MavenEmbedderConfiguration intefrace.
|
||||||
*
|
*
|
||||||
* @author mkleint
|
* @author mkleint
|
||||||
*/
|
*/
|
||||||
public class DefaultMavenEmbedRequest
|
public class DefaultMavenEmbedderConfiguration
|
||||||
implements MavenEmbedRequest
|
implements MavenEmbedderConfiguration
|
||||||
{
|
{
|
||||||
private List inactives;
|
private List inactives;
|
||||||
|
|
||||||
|
@ -53,30 +53,30 @@ public class DefaultMavenEmbedRequest
|
||||||
|
|
||||||
private ClassWorld classWorld;
|
private ClassWorld classWorld;
|
||||||
|
|
||||||
/** Creates a new instance of DefaultMavenEmbedRequest */
|
/** Creates a new instance of DefaultMavenEmbedderConfiguration */
|
||||||
public DefaultMavenEmbedRequest()
|
public DefaultMavenEmbedderConfiguration()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest addActiveProfile( String profile )
|
public MavenEmbedderConfiguration addActiveProfile( String profile )
|
||||||
{
|
{
|
||||||
getActiveProfiles().add( profile );
|
getActiveProfiles().add( profile );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest addInactiveProfile( String profile )
|
public MavenEmbedderConfiguration addInactiveProfile( String profile )
|
||||||
{
|
{
|
||||||
getInactiveProfiles().add( profile );
|
getInactiveProfiles().add( profile );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest addActiveProfiles( List profiles )
|
public MavenEmbedderConfiguration addActiveProfiles( List profiles )
|
||||||
{
|
{
|
||||||
getActiveProfiles().addAll( profiles );
|
getActiveProfiles().addAll( profiles );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest addInactiveProfiles( List profiles )
|
public MavenEmbedderConfiguration addInactiveProfiles( List profiles )
|
||||||
{
|
{
|
||||||
getInactiveProfiles().addAll( profiles );
|
getInactiveProfiles().addAll( profiles );
|
||||||
return this;
|
return this;
|
||||||
|
@ -100,13 +100,13 @@ public class DefaultMavenEmbedRequest
|
||||||
return inactives;
|
return inactives;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest setUserSettingsFile( File user )
|
public MavenEmbedderConfiguration setUserSettingsFile( File user )
|
||||||
{
|
{
|
||||||
userSettings = user;
|
userSettings = user;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest setGlobalSettingsFile( File global )
|
public MavenEmbedderConfiguration setGlobalSettingsFile( File global )
|
||||||
{
|
{
|
||||||
globalSettings = global;
|
globalSettings = global;
|
||||||
return this;
|
return this;
|
||||||
|
@ -122,7 +122,7 @@ public class DefaultMavenEmbedRequest
|
||||||
return globalSettings;
|
return globalSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest setConfigurationCustomizer( ContainerCustomizer customizer )
|
public MavenEmbedderConfiguration setConfigurationCustomizer( ContainerCustomizer customizer )
|
||||||
{
|
{
|
||||||
this.customizer = customizer;
|
this.customizer = customizer;
|
||||||
return this;
|
return this;
|
||||||
|
@ -133,7 +133,7 @@ public class DefaultMavenEmbedRequest
|
||||||
return customizer;
|
return customizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest setSystemProperties( Properties properties )
|
public MavenEmbedderConfiguration setSystemProperties( Properties properties )
|
||||||
{
|
{
|
||||||
systemProperties = properties;
|
systemProperties = properties;
|
||||||
return this;
|
return this;
|
||||||
|
@ -154,7 +154,7 @@ public class DefaultMavenEmbedRequest
|
||||||
return extensions;
|
return extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest setMavenEmbedderLogger( MavenEmbedderLogger logger )
|
public MavenEmbedderConfiguration setMavenEmbedderLogger( MavenEmbedderLogger logger )
|
||||||
{
|
{
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
return this;
|
return this;
|
||||||
|
@ -170,13 +170,13 @@ public class DefaultMavenEmbedRequest
|
||||||
return classWorld;
|
return classWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest setClassWorld( ClassWorld classWorld )
|
public MavenEmbedderConfiguration setClassWorld( ClassWorld classWorld )
|
||||||
{
|
{
|
||||||
this.classWorld = classWorld;
|
this.classWorld = classWorld;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedRequest setClassLoader( ClassLoader loader )
|
public MavenEmbedderConfiguration setClassLoader( ClassLoader loader )
|
||||||
{
|
{
|
||||||
this.classWorld = new ClassWorld( "plexus.core", loader );
|
this.classWorld = new ClassWorld( "plexus.core", loader );
|
||||||
return this;
|
return this;
|
|
@ -142,7 +142,7 @@ public class MavenEmbedder
|
||||||
// User options
|
// User options
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
private MavenEmbedRequest embedderRequest;
|
private MavenEmbedderConfiguration embedderRequest;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Constructors
|
// Constructors
|
||||||
|
@ -158,7 +158,7 @@ public class MavenEmbedder
|
||||||
MavenEmbedderLogger logger )
|
MavenEmbedderLogger logger )
|
||||||
throws MavenEmbedderException
|
throws MavenEmbedderException
|
||||||
{
|
{
|
||||||
this( new DefaultMavenEmbedRequest().setClassWorld( classWorld ).setMavenEmbedderLogger( logger ) );
|
this( new DefaultMavenEmbedderConfiguration().setClassWorld( classWorld ).setMavenEmbedderLogger( logger ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedder( ClassLoader classLoader )
|
public MavenEmbedder( ClassLoader classLoader )
|
||||||
|
@ -174,10 +174,10 @@ public class MavenEmbedder
|
||||||
this( new ClassWorld( "plexus.core", classLoader ), logger );
|
this( new ClassWorld( "plexus.core", classLoader ), logger );
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenEmbedder( MavenEmbedRequest req )
|
public MavenEmbedder( MavenEmbedderConfiguration embedderConfiguration )
|
||||||
throws MavenEmbedderException
|
throws MavenEmbedderException
|
||||||
{
|
{
|
||||||
start( req );
|
start( embedderConfiguration );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -488,7 +488,7 @@ public class MavenEmbedder
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
private void start( MavenEmbedRequest req )
|
private void start( MavenEmbedderConfiguration req )
|
||||||
throws MavenEmbedderException
|
throws MavenEmbedderException
|
||||||
{
|
{
|
||||||
this.classWorld = req.getClassWorld();
|
this.classWorld = req.getClassWorld();
|
||||||
|
|
|
@ -27,46 +27,46 @@ import org.codehaus.plexus.classworlds.ClassWorld;
|
||||||
*
|
*
|
||||||
* @author mkleint
|
* @author mkleint
|
||||||
*/
|
*/
|
||||||
public interface MavenEmbedRequest
|
public interface MavenEmbedderConfiguration
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Add profile to activate.
|
* Add profile to activate.
|
||||||
*/
|
*/
|
||||||
MavenEmbedRequest addActiveProfile( String profile );
|
MavenEmbedderConfiguration addActiveProfile( String profile );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add profile to inactivate.
|
* Add profile to inactivate.
|
||||||
*/
|
*/
|
||||||
MavenEmbedRequest addInactiveProfile( String profile );
|
MavenEmbedderConfiguration addInactiveProfile( String profile );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a list of String instances with names of profiles to activate.
|
* Add a list of String instances with names of profiles to activate.
|
||||||
*/
|
*/
|
||||||
MavenEmbedRequest addActiveProfiles( List profiles );
|
MavenEmbedderConfiguration addActiveProfiles( List profiles );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a list of String instances with names of profiles to inactivate.
|
* Add a list of String instances with names of profiles to inactivate.
|
||||||
*/
|
*/
|
||||||
MavenEmbedRequest addInactiveProfiles( List profiles );
|
MavenEmbedderConfiguration addInactiveProfiles( List profiles );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set location of the user settings file to use for the embedder.
|
* Set location of the user settings file to use for the embedder.
|
||||||
*/
|
*/
|
||||||
MavenEmbedRequest setUserSettingsFile( File user );
|
MavenEmbedderConfiguration setUserSettingsFile( File user );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set location of the global settings file to use for the embedder.
|
* Set location of the global settings file to use for the embedder.
|
||||||
*/
|
*/
|
||||||
MavenEmbedRequest setGlobalSettingsFile( File global );
|
MavenEmbedderConfiguration setGlobalSettingsFile( File global );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a customizer callback implemetation that will be given a chance to modify the plexus container
|
* Set a customizer callback implemetation that will be given a chance to modify the plexus container
|
||||||
* on startup.
|
* on startup.
|
||||||
*/
|
*/
|
||||||
MavenEmbedRequest setConfigurationCustomizer( ContainerCustomizer customizer );
|
MavenEmbedderConfiguration setConfigurationCustomizer( ContainerCustomizer customizer );
|
||||||
|
|
||||||
/** set the system properties to be used during the lifecycle of the embedder. Excluding the time when executing the project, then the properties from MavenExecutionRequestare used. */
|
/** set the system properties to be used during the lifecycle of the embedder. Excluding the time when executing the project, then the properties from MavenExecutionRequestare used. */
|
||||||
MavenEmbedRequest setSystemProperties( Properties properties );
|
MavenEmbedderConfiguration setSystemProperties( Properties properties );
|
||||||
|
|
||||||
List getActiveProfiles();
|
List getActiveProfiles();
|
||||||
|
|
||||||
|
@ -84,13 +84,13 @@ public interface MavenEmbedRequest
|
||||||
|
|
||||||
List getExtensions();
|
List getExtensions();
|
||||||
|
|
||||||
public MavenEmbedRequest setMavenEmbedderLogger( MavenEmbedderLogger logger );
|
public MavenEmbedderConfiguration setMavenEmbedderLogger( MavenEmbedderLogger logger );
|
||||||
|
|
||||||
public MavenEmbedderLogger getMavenEmbedderLogger();
|
public MavenEmbedderLogger getMavenEmbedderLogger();
|
||||||
|
|
||||||
public ClassWorld getClassWorld();
|
public ClassWorld getClassWorld();
|
||||||
|
|
||||||
public MavenEmbedRequest setClassWorld( ClassWorld classWorld );
|
public MavenEmbedderConfiguration setClassWorld( ClassWorld classWorld );
|
||||||
|
|
||||||
public MavenEmbedRequest setClassLoader( ClassLoader loader );
|
public MavenEmbedderConfiguration setClassLoader( ClassLoader loader );
|
||||||
}
|
}
|
|
@ -230,8 +230,6 @@ public class MavenEmbedderTest
|
||||||
assertEquals( 1, artifacts.size() );
|
assertEquals( 1, artifacts.size() );
|
||||||
|
|
||||||
Artifact artifact = (Artifact) artifacts.iterator().next();
|
Artifact artifact = (Artifact) artifacts.iterator().next();
|
||||||
|
|
||||||
System.out.println( "artifact = " + artifact );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testProjectWithExtensionsReading()
|
public void testProjectWithExtensionsReading()
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class TestComponentOverride
|
||||||
|
|
||||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||||
|
|
||||||
MavenEmbedRequest request = new DefaultMavenEmbedRequest();
|
MavenEmbedderConfiguration request = new DefaultMavenEmbedderConfiguration();
|
||||||
|
|
||||||
request.setClassLoader( loader );
|
request.setClassLoader( loader );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue