mirror of https://github.com/apache/maven.git
o restoring assembly descriptor so that I can actually build from within this module
o all the use of an embedder request with no settings file information and have the defaults just kick in git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@491334 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
646c67db17
commit
df12fcab5d
|
@ -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.v20061129-1142</bundleVersion>
|
<bundleVersion>2.1.0.v20061230-1718</bundleVersion>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
<dependencySets>
|
<dependencySets>
|
||||||
<dependencySet>
|
<dependencySet>
|
||||||
<outputDirectory>/</outputDirectory>
|
<outputDirectory>/</outputDirectory>
|
||||||
<outputFileNameMapping></outputFileNameMapping>
|
|
||||||
<unpack>true</unpack>
|
<unpack>true</unpack>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
<excludes>
|
<excludes>
|
||||||
|
|
|
@ -155,75 +155,60 @@ public class MavenEmbedder
|
||||||
/**
|
/**
|
||||||
* This option determines whether the embedder is to be aligned to the user
|
* This option determines whether the embedder is to be aligned to the user
|
||||||
* installation.
|
* installation.
|
||||||
|
*
|
||||||
* @deprecated not used
|
* @deprecated not used
|
||||||
*/
|
*/
|
||||||
private boolean alignWithUserInstallation;
|
private boolean alignWithUserInstallation;
|
||||||
|
|
||||||
private boolean started = false;
|
private boolean started = false;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Accessors
|
// Accessors
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/** @deprecated not used. */
|
||||||
* @deprecated not used.
|
|
||||||
*/
|
|
||||||
public void setInteractiveMode( boolean interactiveMode )
|
public void setInteractiveMode( boolean interactiveMode )
|
||||||
{
|
{
|
||||||
this.interactiveMode = interactiveMode;
|
this.interactiveMode = interactiveMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @deprecated not used. */
|
||||||
* @deprecated not used.
|
|
||||||
*/
|
|
||||||
public boolean isInteractiveMode()
|
public boolean isInteractiveMode()
|
||||||
{
|
{
|
||||||
return interactiveMode;
|
return interactiveMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @deprecated not used. */
|
||||||
* @deprecated not used.
|
|
||||||
*/
|
|
||||||
public void setOffline( boolean offline )
|
public void setOffline( boolean offline )
|
||||||
{
|
{
|
||||||
this.offline = offline;
|
this.offline = offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @deprecated not used. */
|
||||||
* @deprecated not used.
|
|
||||||
*/
|
|
||||||
public boolean isOffline()
|
public boolean isOffline()
|
||||||
{
|
{
|
||||||
return offline;
|
return offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @deprecated not used. */
|
||||||
* @deprecated not used.
|
|
||||||
*/
|
|
||||||
public void setGlobalChecksumPolicy( String globalChecksumPolicy )
|
public void setGlobalChecksumPolicy( String globalChecksumPolicy )
|
||||||
{
|
{
|
||||||
this.globalChecksumPolicy = globalChecksumPolicy;
|
this.globalChecksumPolicy = globalChecksumPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @deprecated not used. */
|
||||||
* @deprecated not used.
|
|
||||||
*/
|
|
||||||
public String getGlobalChecksumPolicy()
|
public String getGlobalChecksumPolicy()
|
||||||
{
|
{
|
||||||
return globalChecksumPolicy;
|
return globalChecksumPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @deprecated not used. */
|
||||||
* @deprecated not used.
|
|
||||||
*/
|
|
||||||
public boolean isAlignWithUserInstallation()
|
public boolean isAlignWithUserInstallation()
|
||||||
{
|
{
|
||||||
return alignWithUserInstallation;
|
return alignWithUserInstallation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @deprecated not used */
|
||||||
* @deprecated not used
|
|
||||||
*/
|
|
||||||
public void setAlignWithUserInstallation( boolean alignWithUserInstallation )
|
public void setAlignWithUserInstallation( boolean alignWithUserInstallation )
|
||||||
{
|
{
|
||||||
this.alignWithUserInstallation = alignWithUserInstallation;
|
this.alignWithUserInstallation = alignWithUserInstallation;
|
||||||
|
@ -254,20 +239,18 @@ public class MavenEmbedder
|
||||||
return classWorld;
|
return classWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @deprecated not used. */
|
||||||
* @deprecated not used.
|
|
||||||
*/
|
|
||||||
public void setLocalRepositoryDirectory( File localRepositoryDirectory )
|
public void setLocalRepositoryDirectory( File localRepositoryDirectory )
|
||||||
{
|
{
|
||||||
this.localRepositoryDirectory = localRepositoryDirectory;
|
this.localRepositoryDirectory = localRepositoryDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public File getLocalRepositoryDirectory()
|
public File getLocalRepositoryDirectory()
|
||||||
{
|
{
|
||||||
return new File(getLocalRepositoryPath(settings));
|
return new File( getLocalRepositoryPath( settings ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactRepository getLocalRepository()
|
public ArtifactRepository getLocalRepository()
|
||||||
|
@ -308,7 +291,8 @@ public class MavenEmbedder
|
||||||
* write the model.
|
* write the model.
|
||||||
* requires a start()-ed embedder.
|
* requires a start()-ed embedder.
|
||||||
*/
|
*/
|
||||||
public void writeModel( Writer writer, Model model )
|
public void writeModel( Writer writer,
|
||||||
|
Model model )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
|
@ -330,11 +314,13 @@ public class MavenEmbedder
|
||||||
return mavenProjectBuilder.build( mavenProject, localRepository, profileManager );
|
return mavenProjectBuilder.build( mavenProject, localRepository, profileManager );
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenProject readProjectWithDependencies( File mavenProject, TransferListener transferListener )
|
public MavenProject readProjectWithDependencies( File mavenProject,
|
||||||
|
TransferListener transferListener )
|
||||||
throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException
|
throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
return mavenProjectBuilder.buildWithDependencies( mavenProject, localRepository, profileManager, transferListener );
|
return mavenProjectBuilder.buildWithDependencies( mavenProject, localRepository, profileManager,
|
||||||
|
transferListener );
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenProject readProjectWithDependencies( File mavenProject )
|
public MavenProject readProjectWithDependencies( File mavenProject )
|
||||||
|
@ -386,7 +372,9 @@ public class MavenEmbedder
|
||||||
return new DefaultMavenExecutionResult( project, Collections.EMPTY_LIST );
|
return new DefaultMavenExecutionResult( project, Collections.EMPTY_LIST );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List collectProjects( File basedir, String[] includes, String[] excludes )
|
public List collectProjects( File basedir,
|
||||||
|
String[] includes,
|
||||||
|
String[] excludes )
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
|
@ -418,19 +406,29 @@ public class MavenEmbedder
|
||||||
// Artifacts
|
// Artifacts
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
|
public Artifact createArtifact( String groupId,
|
||||||
|
String artifactId,
|
||||||
|
String version,
|
||||||
|
String scope,
|
||||||
|
String type )
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
return artifactFactory.createArtifact( groupId, artifactId, version, scope, type );
|
return artifactFactory.createArtifact( groupId, artifactId, version, scope, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier )
|
public Artifact createArtifactWithClassifier( String groupId,
|
||||||
|
String artifactId,
|
||||||
|
String version,
|
||||||
|
String type,
|
||||||
|
String classifier )
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
|
return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
|
public void resolve( Artifact artifact,
|
||||||
|
List remoteRepositories,
|
||||||
|
ArtifactRepository localRepository )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
|
@ -459,7 +457,8 @@ public class MavenEmbedder
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
InputStream is = classLoader.getResourceAsStream( "/plugins/" + summaryPluginDescriptor.getArtifactId() + ".xml" );
|
InputStream is =
|
||||||
|
classLoader.getResourceAsStream( "/plugins/" + summaryPluginDescriptor.getArtifactId() + ".xml" );
|
||||||
|
|
||||||
pluginDescriptor = pluginDescriptorBuilder.build( new InputStreamReader( is ) );
|
pluginDescriptor = pluginDescriptorBuilder.build( new InputStreamReader( is ) );
|
||||||
}
|
}
|
||||||
|
@ -471,7 +470,9 @@ public class MavenEmbedder
|
||||||
return pluginDescriptor;
|
return pluginDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SummaryPluginDescriptor makeMockPlugin( String groupId, String artifactId, String name )
|
private SummaryPluginDescriptor makeMockPlugin( String groupId,
|
||||||
|
String artifactId,
|
||||||
|
String name )
|
||||||
{
|
{
|
||||||
return new SummaryPluginDescriptor( groupId, artifactId, name );
|
return new SummaryPluginDescriptor( groupId, artifactId, name );
|
||||||
}
|
}
|
||||||
|
@ -494,7 +495,8 @@ public class MavenEmbedder
|
||||||
|
|
||||||
PlexusConfiguration configuration = descriptor.getConfiguration();
|
PlexusConfiguration configuration = descriptor.getConfiguration();
|
||||||
|
|
||||||
PlexusConfiguration[] phasesConfigurations = configuration.getChild( "lifecycles" ).getChild( 0 ).getChild( "phases" ).getChildren( "phase" );
|
PlexusConfiguration[] phasesConfigurations =
|
||||||
|
configuration.getChild( "lifecycles" ).getChild( 0 ).getChild( "phases" ).getChildren( "phase" );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -534,7 +536,8 @@ public class MavenEmbedder
|
||||||
return createLocalRepository( mavenTools.getLocalRepositoryPath( settings ), DEFAULT_LOCAL_REPO_ID );
|
return createLocalRepository( mavenTools.getLocalRepositoryPath( settings ), DEFAULT_LOCAL_REPO_ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactRepository createLocalRepository( String url, String repositoryId )
|
public ArtifactRepository createLocalRepository( String url,
|
||||||
|
String repositoryId )
|
||||||
{
|
{
|
||||||
if ( !url.startsWith( "file:" ) )
|
if ( !url.startsWith( "file:" ) )
|
||||||
{
|
{
|
||||||
|
@ -544,7 +547,8 @@ public class MavenEmbedder
|
||||||
return createRepository( url, repositoryId );
|
return createRepository( url, repositoryId );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactRepository createRepository( String url, String repositoryId )
|
public ArtifactRepository createRepository( String url,
|
||||||
|
String repositoryId )
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
// snapshots vs releases
|
// snapshots vs releases
|
||||||
|
@ -556,18 +560,23 @@ public class MavenEmbedder
|
||||||
|
|
||||||
String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
|
String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
|
||||||
|
|
||||||
ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );
|
ArtifactRepositoryPolicy snapshotsPolicy =
|
||||||
|
new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );
|
||||||
|
|
||||||
ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );
|
ArtifactRepositoryPolicy releasesPolicy =
|
||||||
|
new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );
|
||||||
|
|
||||||
return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout, snapshotsPolicy, releasesPolicy );
|
return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout,
|
||||||
|
snapshotsPolicy, releasesPolicy );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Internal utility code
|
// Internal utility code
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
private List getPomFiles( File basedir, String[] includes, String[] excludes )
|
private List getPomFiles( File basedir,
|
||||||
|
String[] includes,
|
||||||
|
String[] excludes )
|
||||||
{
|
{
|
||||||
DirectoryScanner scanner = new DirectoryScanner();
|
DirectoryScanner scanner = new DirectoryScanner();
|
||||||
|
|
||||||
|
@ -596,14 +605,13 @@ public class MavenEmbedder
|
||||||
public void start()
|
public void start()
|
||||||
throws MavenEmbedderException
|
throws MavenEmbedderException
|
||||||
{
|
{
|
||||||
start(new DefaultMavenEmbedRequest());
|
start( new DefaultMavenEmbedRequest() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(MavenEmbedRequest req)
|
public void start( MavenEmbedRequest req )
|
||||||
throws MavenEmbedderException
|
throws MavenEmbedderException
|
||||||
{
|
{
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Set the maven.home system property which is need by components like
|
// Set the maven.home system property which is need by components like
|
||||||
// the plugin registry builder.
|
// the plugin registry builder.
|
||||||
|
@ -611,7 +619,8 @@ public class MavenEmbedder
|
||||||
|
|
||||||
if ( classWorld == null && classLoader == null )
|
if ( classWorld == null && classLoader == null )
|
||||||
{
|
{
|
||||||
throw new IllegalStateException( "A classWorld or classloader must be specified using setClassLoader|World(ClassLoader)." );
|
throw new IllegalStateException(
|
||||||
|
"A classWorld or classloader must be specified using setClassLoader|World(ClassLoader)." );
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -622,8 +631,8 @@ public class MavenEmbedder
|
||||||
{
|
{
|
||||||
throw new MavenEmbedderException( "Error starting Maven embedder.", e );
|
throw new MavenEmbedderException( "Error starting Maven embedder.", e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( logger != null )
|
if ( logger != null )
|
||||||
{
|
{
|
||||||
container.setLoggerManager( new MavenEmbedderLoggerManager( new PlexusLoggerAdapter( logger ) ) );
|
container.setLoggerManager( new MavenEmbedderLoggerManager( new PlexusLoggerAdapter( logger ) ) );
|
||||||
|
@ -640,12 +649,12 @@ public class MavenEmbedder
|
||||||
|
|
||||||
// TODO verify that this is not needed...
|
// TODO verify that this is not needed...
|
||||||
// embedder.start( classWorld );
|
// embedder.start( classWorld );
|
||||||
|
|
||||||
if (req.getContainerCustomizer() != null)
|
if ( req.getContainerCustomizer() != null )
|
||||||
{
|
{
|
||||||
req.getContainerCustomizer().customize(container);
|
req.getContainerCustomizer().customize( container );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Lookup each of the components we need to provide the desired
|
// Lookup each of the components we need to provide the desired
|
||||||
// client interface.
|
// client interface.
|
||||||
|
@ -662,10 +671,10 @@ public class MavenEmbedder
|
||||||
pluginDescriptorBuilder = new PluginDescriptorBuilder();
|
pluginDescriptorBuilder = new PluginDescriptorBuilder();
|
||||||
|
|
||||||
profileManager = new DefaultProfileManager( container, req.getSystemProperties() );
|
profileManager = new DefaultProfileManager( container, req.getSystemProperties() );
|
||||||
|
|
||||||
profileManager.explicitlyActivate(req.getActiveProfiles());
|
profileManager.explicitlyActivate( req.getActiveProfiles() );
|
||||||
|
|
||||||
profileManager.explicitlyDeactivate(req.getInactiveProfiles());
|
profileManager.explicitlyDeactivate( req.getInactiveProfiles() );
|
||||||
|
|
||||||
mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE );
|
mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE );
|
||||||
|
|
||||||
|
@ -679,24 +688,39 @@ public class MavenEmbedder
|
||||||
|
|
||||||
artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
|
artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
|
||||||
|
|
||||||
defaultArtifactRepositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, DEFAULT_LAYOUT_ID );
|
defaultArtifactRepositoryLayout =
|
||||||
|
(ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, DEFAULT_LAYOUT_ID );
|
||||||
|
|
||||||
lifecycleExecutor = (LifecycleExecutor) container.lookup( LifecycleExecutor.ROLE );
|
lifecycleExecutor = (LifecycleExecutor) container.lookup( LifecycleExecutor.ROLE );
|
||||||
|
|
||||||
wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
|
wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
|
||||||
|
|
||||||
settings = mavenTools.buildSettings( req.getUserSettingsFile(),
|
|
||||||
req.getGlobalSettingsFile(),
|
|
||||||
null );
|
|
||||||
|
|
||||||
profileManager.loadSettingsProfiles( settings );
|
|
||||||
|
|
||||||
resolveParameters( settings );
|
|
||||||
|
|
||||||
started = true;
|
started = true;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Settings
|
||||||
|
//
|
||||||
|
// If the settings file and the global settings file are null then we will use
|
||||||
|
// the defaults that Maven provides.
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if ( req.getUserSettingsFile() == null )
|
||||||
|
{
|
||||||
|
req.setUserSettingsFile( mavenTools.getUserSettingsPath( null ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( req.getGlobalSettingsFile() == null )
|
||||||
|
{
|
||||||
|
req.setGlobalSettingsFile( mavenTools.getGlobalSettingsPath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
settings = mavenTools.buildSettings( req.getUserSettingsFile(), req.getGlobalSettingsFile(), null );
|
||||||
|
|
||||||
|
resolveParameters( settings );
|
||||||
|
|
||||||
localRepository = createLocalRepository( settings );
|
localRepository = createLocalRepository( settings );
|
||||||
|
|
||||||
|
profileManager.loadSettingsProfiles( settings );
|
||||||
}
|
}
|
||||||
catch ( DuplicateRealmException e )
|
catch ( DuplicateRealmException e )
|
||||||
{
|
{
|
||||||
|
@ -705,17 +729,17 @@ public class MavenEmbedder
|
||||||
catch ( ComponentLookupException e )
|
catch ( ComponentLookupException e )
|
||||||
{
|
{
|
||||||
throw new MavenEmbedderException( "Cannot lookup required component.", e );
|
throw new MavenEmbedderException( "Cannot lookup required component.", e );
|
||||||
}
|
}
|
||||||
catch (SettingsConfigurationException e )
|
catch ( SettingsConfigurationException e )
|
||||||
{
|
{
|
||||||
throw new MavenEmbedderException( "Cannot create settings configuration", e );
|
throw new MavenEmbedderException( "Cannot create settings configuration", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MKLEINT: copied from DefaultMaven. the wagonManager was not injected with proxy info
|
* MKLEINT: copied from DefaultMaven. the wagonManager was not injected with proxy info
|
||||||
* when called in non-execute mode..
|
* when called in non-execute mode..
|
||||||
*
|
*
|
||||||
* @todo [BP] this might not be required if there is a better way to pass
|
* @todo [BP] this might not be required if there is a better way to pass
|
||||||
* them in. It doesn't feel quite right.
|
* them in. It doesn't feel quite right.
|
||||||
* @todo [JC] we should at least provide a mapping of protocol-to-proxy for
|
* @todo [JC] we should at least provide a mapping of protocol-to-proxy for
|
||||||
|
@ -724,45 +748,43 @@ public class MavenEmbedder
|
||||||
private void resolveParameters( Settings settings )
|
private void resolveParameters( Settings settings )
|
||||||
throws SettingsConfigurationException
|
throws SettingsConfigurationException
|
||||||
{
|
{
|
||||||
|
|
||||||
Proxy proxy = settings.getActiveProxy();
|
Proxy proxy = settings.getActiveProxy();
|
||||||
|
|
||||||
if ( proxy != null )
|
if ( proxy != null )
|
||||||
{
|
{
|
||||||
if ( proxy.getHost() == null )
|
if ( proxy.getHost() == null )
|
||||||
{
|
{
|
||||||
throw new SettingsConfigurationException( "Proxy in settings.xml has no host" );
|
throw new SettingsConfigurationException( "Proxy in settings.xml has no host" );
|
||||||
}
|
}
|
||||||
System.out.println("setting proxy to=" + proxy.getHost());
|
System.out.println( "setting proxy to=" + proxy.getHost() );
|
||||||
wagonManager.addProxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(),
|
wagonManager.addProxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(),
|
||||||
proxy.getPassword(), proxy.getNonProxyHosts() );
|
proxy.getPassword(), proxy.getNonProxyHosts() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator i = settings.getServers().iterator(); i.hasNext(); )
|
for ( Iterator i = settings.getServers().iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
Server server = (Server) i.next();
|
Server server = (Server) i.next();
|
||||||
|
|
||||||
wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), server.getPassword(),
|
wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), server.getPassword(),
|
||||||
server.getPrivateKey(), server.getPassphrase() );
|
server.getPrivateKey(), server.getPassphrase() );
|
||||||
|
|
||||||
wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(),
|
wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(),
|
||||||
server.getDirectoryPermissions() );
|
server.getDirectoryPermissions() );
|
||||||
|
|
||||||
if ( server.getConfiguration() != null )
|
if ( server.getConfiguration() != null )
|
||||||
{
|
{
|
||||||
wagonManager.addConfiguration( server.getId(), (Xpp3Dom) server.getConfiguration() );
|
wagonManager.addConfiguration( server.getId(), (Xpp3Dom) server.getConfiguration() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator i = settings.getMirrors().iterator(); i.hasNext(); )
|
for ( Iterator i = settings.getMirrors().iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
Mirror mirror = (Mirror) i.next();
|
Mirror mirror = (Mirror) i.next();
|
||||||
|
|
||||||
wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
|
wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
|
@ -794,7 +816,7 @@ public class MavenEmbedder
|
||||||
throws MavenExecutionException
|
throws MavenExecutionException
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
maven.execute( request );
|
maven.execute( request );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Settings buildSettings( File userSettingsPath,
|
public Settings buildSettings( File userSettingsPath,
|
||||||
|
@ -806,25 +828,40 @@ public class MavenEmbedder
|
||||||
throws SettingsConfigurationException
|
throws SettingsConfigurationException
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
return mavenTools.buildSettings( userSettingsPath,
|
return mavenTools.buildSettings( userSettingsPath, globalSettingsPath, interactive, offline, usePluginRegistry,
|
||||||
globalSettingsPath,
|
pluginUpdateOverride );
|
||||||
interactive,
|
|
||||||
offline,
|
|
||||||
usePluginRegistry,
|
|
||||||
pluginUpdateOverride );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Settings buildSettings( File userSettingsPath,
|
||||||
|
File globalSettingsPath,
|
||||||
|
boolean interactive,
|
||||||
|
boolean offline,
|
||||||
|
boolean usePluginRegistry,
|
||||||
|
boolean pluginUpdateOverride )
|
||||||
|
throws SettingsConfigurationException
|
||||||
|
{
|
||||||
|
checkStarted();
|
||||||
|
return mavenTools.buildSettings( userSettingsPath, globalSettingsPath, interactive, offline, usePluginRegistry,
|
||||||
|
Boolean.valueOf( pluginUpdateOverride ) );
|
||||||
|
}
|
||||||
|
|
||||||
public Settings buildSettings( File userSettingsPath,
|
public Settings buildSettings( File userSettingsPath,
|
||||||
File globalSettingsPath,
|
File globalSettingsPath,
|
||||||
Boolean pluginUpdateOverride )
|
Boolean pluginUpdateOverride )
|
||||||
throws SettingsConfigurationException
|
throws SettingsConfigurationException
|
||||||
{
|
{
|
||||||
checkStarted();
|
checkStarted();
|
||||||
return mavenTools.buildSettings( userSettingsPath,
|
return mavenTools.buildSettings( userSettingsPath, globalSettingsPath, pluginUpdateOverride );
|
||||||
globalSettingsPath,
|
}
|
||||||
pluginUpdateOverride );
|
|
||||||
|
public Settings buildSettings( File userSettingsPath,
|
||||||
|
File globalSettingsPath,
|
||||||
|
boolean pluginUpdateOverride )
|
||||||
|
throws SettingsConfigurationException
|
||||||
|
{
|
||||||
|
checkStarted();
|
||||||
|
return mavenTools.buildSettings( userSettingsPath, globalSettingsPath, Boolean.valueOf( pluginUpdateOverride ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public File getUserSettingsPath( String optionalSettingsPath )
|
public File getUserSettingsPath( String optionalSettingsPath )
|
||||||
{
|
{
|
||||||
|
@ -843,10 +880,13 @@ public class MavenEmbedder
|
||||||
checkStarted();
|
checkStarted();
|
||||||
return mavenTools.getLocalRepositoryPath( settings );
|
return mavenTools.getLocalRepositoryPath( settings );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkStarted() {
|
private void checkStarted()
|
||||||
if (!started) {
|
{
|
||||||
throw new IllegalStateException("The embedder is not started, you need to call start() on the embedder prior to calling this method");
|
if ( !started )
|
||||||
}
|
{
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"The embedder is not started, you need to call start() on the embedder prior to calling this method" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue