o refactoring the way plugin prefix metadata is found. the lifecycle executor is not the right place for this and the plugin manager is now strictly for already fully configured executions. so it belongs somewhere specific to augmenting the base set of information in order to make it complete but this first pass will do here. i just want to check it in as well because i'm traveling.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@783361 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-06-10 13:40:14 +00:00
parent 5cde8bfe4b
commit 864ea15216
14 changed files with 456 additions and 488 deletions

View File

@ -64,11 +64,6 @@ public class DefaultMaven
@Requirement
protected PlexusContainer container;
public List<String> getLifecyclePhases()
{
return lifecycleExecutor.getLifecyclePhases();
}
public MavenExecutionResult execute( MavenExecutionRequest request )
{
//TODO: Need a general way to inject standard properties
@ -93,7 +88,7 @@ public MavenExecutionResult execute( MavenExecutionRequest request )
try
{
projects = getProjects( request );
projects = getProjectsForMavenReactor( request );
//TODO: We really need to get rid of this requirement in here. If we know there is no project present
if ( projects.isEmpty() )
@ -171,7 +166,7 @@ private MavenExecutionResult processResult( MavenExecutionResult result, Excepti
return result;
}
public Map<String,MavenProject> getProjects( MavenExecutionRequest request )
protected Map<String,MavenProject> getProjectsForMavenReactor( MavenExecutionRequest request )
throws MavenExecutionException, ProjectBuildingException
{
// We have no POM file.

View File

@ -19,8 +19,6 @@
* under the License.
*/
import java.util.List;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult;
@ -32,6 +30,4 @@ public interface Maven
String POMv4 = "pom.xml";
MavenExecutionResult execute( MavenExecutionRequest request );
List<String> getLifecyclePhases();
}

View File

@ -1,57 +0,0 @@
package org.apache.maven.execution;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Describe a build failure in the reactor.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
public class BuildFailure
{
private final Exception cause;
private final String task;
private final long time;
BuildFailure( Exception cause, String task, long time )
{
this.cause = cause;
this.task = task;
this.time = time;
}
public String getTask()
{
return task;
}
public Exception getCause()
{
return cause;
}
public long getTime()
{
return time;
}
}

View File

@ -1,51 +0,0 @@
package org.apache.maven.execution;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.project.MavenProject;
/**
* Describe a build success in the reactor.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
public class BuildSuccess
{
private final MavenProject project;
private final long time;
public BuildSuccess( MavenProject project, long time )
{
this.project = project;
this.time = time;
}
public MavenProject getProject()
{
return project;
}
public long getTime()
{
return time;
}
}

View File

@ -68,14 +68,8 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
//TODO: The configuration for the lifecycle needs to be externalized so that I can use the annotations
// properly for the wiring and reference and external source for the lifecycle configuration.
//TODO: The configuration for the lifecycle needs to be externalized so that I can use the annotations properly for the wiring and reference and external source for the lifecycle configuration.
//TODO: check for online status in the build plan and die if necessary
//TODO if ( mojoDescriptor.isProjectRequired() && !session.isUsingPOMsFromFilesystem() )
//{
// throw new PluginExecutionException( mojoExecution, project, "Cannot execute mojo: " + mojoDescriptor.getGoal()
// + ". It requires a project with an existing pom.xml, but the build is not using one." );
//}
/**
* @author Jason van Zyl
@ -92,23 +86,32 @@ public class DefaultLifecycleExecutor
@Requirement
protected RepositorySystem repositorySystem;
/**
* These mappings correspond to packaging types, like WAR packaging, which configure a particular mojos
* to run in a given phase.
*/
@Requirement
private Map<String, LifecycleMapping> lifecycleMappings;
@Requirement
private ProjectDependenciesResolver projectDependenciesResolver;
// @Configuration(source="org/apache/maven/lifecycle/lifecycles.xml")
private List<Lifecycle> lifecycles;
/**
* We use this to display all the lifecycles available and their phases to users. Currently this is primarily
* used in the IDE integrations where a UI is presented to the user and they can select the lifecycle phase
* they would like to execute.
*/
private Map<String,Lifecycle> lifecycleMap;
/**
* We use this to map all phases to the lifecycle that contains it. This is used so that a user can specify the
* phase they want to execute and we can easily determine what lifecycle we need to run.
*/
private Map<String, Lifecycle> phaseToLifecycleMap;
/**
* These mappings correspond to packaging types, like WAR packaging, which configure a particular mojos
* to run in a given phase.
*/
@Requirement
private Map<String, LifecycleMapping> lifecycleMappings;
public void execute( MavenSession session )
{
// TODO: Use a listener here instead of loggers
@ -216,29 +219,61 @@ public void execute( MavenSession session )
}
}
// 1. Find the lifecycle given the phase (default lifecycle when given install)
// 2. Find the lifecycle mapping that corresponds to the project packaging (jar lifecycle mapping given the jar packaging)
// 3. Find the mojos associated with the lifecycle given the project packaging (jar lifecycle mapping for the default lifecycle)
// 4. Bind those mojos found in the lifecycle mapping for the packaging to the lifecycle
// 5. Bind mojos specified in the project itself to the lifecycle
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, PluginManagerException
{
MavenProject project = session.getCurrentProject();
List<MojoExecution> phasesWithMojosToExecute = new ArrayList<MojoExecution>();
List<MojoExecution> lifecyclePlan = new ArrayList<MojoExecution>();
String requiredDependencyResolutionScope = null;
for ( String task : tasks )
{
if ( task.indexOf( ":" ) > 0 )
{
// If this is a goal like "mvn modello:java" and the POM looks like the following:
calculateExecutionForIndividualGoal( session, lifecyclePlan, task );
}
else
{
calculateExecutionForLifecyclePhase( session, lifecyclePlan, task );
}
}
// 7. Now we create the correct configuration for the mojo to execute.
//
for ( MojoExecution mojoExecution : lifecyclePlan )
{
// These are bits that look like this:
//
// org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
//
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( mojoExecution.getGroupId(), mojoExecution.getArtifactId(), mojoExecution.getVersion(), mojoExecution.getGoal(), session
.getLocalRepository(), project.getRemoteArtifactRepositories() );
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
if ( pluginDescriptor.getPlugin().isExtensions() )
{
pluginDescriptor.setClassRealm( pluginManager.getPluginRealm( session, pluginDescriptor ) );
}
requiredDependencyResolutionScope = calculateRequiredDependencyResolutionScope( requiredDependencyResolutionScope, mojoDescriptor.isDependencyResolutionRequired() );
mojoExecution.setMojoDescriptor( mojoDescriptor );
populateMojoExecutionConfiguration( project, mojoExecution, false );
}
return new MavenExecutionPlan( lifecyclePlan, requiredDependencyResolutionScope );
}
private void calculateExecutionForIndividualGoal( MavenSession session, List<MojoExecution> lifecyclePlan, String goal )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException
{
MavenProject project = session.getCurrentProject();
// If this is a goal like "mvn modello:java" and the POM looks like the following:
//
// <project>
// <modelVersion>4.0.0</modelVersion>
// <groupId>org.apache.maven.plugins</groupId>
@ -267,9 +302,7 @@ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String..
// - attach that to the MojoExecution for its configuration
// - give the MojoExecution an id of default-<goal>.
MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session );
requiredDependencyResolutionScope = mojoDescriptor.isDependencyResolutionRequired();
MojoDescriptor mojoDescriptor = getMojoDescriptor( goal, session );
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, "default-" + mojoDescriptor.getGoal() );
@ -277,13 +310,22 @@ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String..
lifecyclePlan.add( mojoExecution );
}
else
// 1. Find the lifecycle given the phase (default lifecycle when given install)
// 2. Find the lifecycle mapping that corresponds to the project packaging (jar lifecycle mapping given the jar packaging)
// 3. Find the mojos associated with the lifecycle given the project packaging (jar lifecycle mapping for the default lifecycle)
// 4. Bind those mojos found in the lifecycle mapping for the packaging to the lifecycle
// 5. Bind mojos specified in the project itself to the lifecycle
private void calculateExecutionForLifecyclePhase( MavenSession session, List<MojoExecution> lifecyclePlan, String lifecyclePhase )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException
{
MavenProject project = session.getCurrentProject();
// 1.
//
// Based on the lifecycle phase we are given, let's find the corresponding lifecycle.
//
Lifecycle lifecycle = phaseToLifecycleMap.get( task );
Lifecycle lifecycle = phaseToLifecycleMap.get( lifecyclePhase );
// 2.
//
@ -379,39 +421,14 @@ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String..
//
for ( String phase : phaseToMojoMapping.keySet() )
{
phasesWithMojosToExecute.addAll( phaseToMojoMapping.get( phase ) );
lifecyclePlan.addAll( phaseToMojoMapping.get( phase ) );
if ( phase.equals( task ) )
if ( phase.equals( lifecyclePhase ) )
{
break;
}
}
}
}
// 7. Now we create the correct configuration for the mojo to execute.
//TODO: this needs to go to the model builder.
//TODO: just used a hollowed out MojoExecution
for ( MojoExecution mojoExecution : phasesWithMojosToExecute )
{
// These are bits that look like this:
//
// org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
//
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor(
mojoExecution.getPlugin(), mojoExecution.getGoal(), session.getLocalRepository(), project.getPluginArtifactRepositories() );
requiredDependencyResolutionScope = calculateRequiredDependencyResolutionScope( requiredDependencyResolutionScope, mojoDescriptor.isDependencyResolutionRequired() );
mojoExecution.setMojoDescriptor( mojoDescriptor );
populateMojoExecutionConfiguration( project, mojoExecution, false );
lifecyclePlan.add( mojoExecution );
}
return new MavenExecutionPlan( lifecyclePlan, requiredDependencyResolutionScope );
}
// SCOPE_COMPILE
// SCOPE_TEST
@ -567,10 +584,49 @@ MojoDescriptor getMojoDescriptor( String task, MavenSession session )
Plugin plugin = null;
StringTokenizer tok = new StringTokenizer( task, ":" );
int numTokens = tok.countTokens();
if ( numTokens == 4 )
{
// We have everything that we need
//
// org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
//
// groupId
// artifactId
// version
// goal
//
plugin = new Plugin();
plugin.setGroupId( tok.nextToken() );
plugin.setArtifactId( tok.nextToken() );
plugin.setVersion( tok.nextToken() );
goal = tok.nextToken();
}
else if ( numTokens == 3 )
{
// We have everything that we need except the version
//
// org.apache.maven.plugins:maven-remote-resources-plugin:???:process
//
// groupId
// artifactId
// ???
// goal
//
plugin = new Plugin();
plugin.setGroupId( tok.nextToken() );
plugin.setArtifactId( tok.nextToken() );
goal = tok.nextToken();
}
if ( numTokens == 2 )
{
// We have a prefix and goal
//
// idea:idea
//
String prefix = tok.nextToken();
goal = tok.nextToken();
@ -585,63 +641,51 @@ MojoDescriptor getMojoDescriptor( String task, MavenSession session )
plugin = findPluginForPrefix( prefix, session );
}
else if ( numTokens == 3 || numTokens == 4 )
{
plugin = new Plugin();
plugin.setGroupId( tok.nextToken() );
plugin.setArtifactId( tok.nextToken() );
if ( numTokens == 4 )
{
plugin.setVersion( tok.nextToken() );
}
goal = tok.nextToken();
}
if ( plugin.getVersion() == null )
{
// We need to get it from the POM first before anything else
//
for ( Plugin pluginInPom : project.getBuildPlugins() )
{
if ( pluginInPom.getArtifactId().equals( plugin.getArtifactId() ) )
{
plugin.setVersion( pluginInPom.getVersion() );
break;
}
}
if ( plugin.getVersion() == null && project.getPluginManagement() != null )
{
for ( Plugin pluginInPom : project.getPluginManagement().getPlugins() )
{
if ( pluginInPom.getArtifactId().equals( plugin.getArtifactId() ) )
{
plugin.setVersion( pluginInPom.getVersion() );
break;
}
}
}
plugin.setVersion( attemptToGetPluginVersionFromProject( plugin, project ) );
// If there is no version to be found then we need to look in the repository metadata for
// this plugin and see what's specified as the latest release.
//
if ( plugin.getVersion() == null )
{
for ( ArtifactRepository repository : session.getCurrentProject().getRemoteArtifactRepositories() )
File artifactMetadataFile;
String localPath;
// Search in the local repositiory for a version
//
// maven-metadata-local.xml
//
localPath = plugin.getGroupId().replace( '.', '/' ) + "/" + plugin.getArtifactId() + "/maven-metadata-" + session.getLocalRepository().getId() + ".xml";
artifactMetadataFile = new File( session.getLocalRepository().getBasedir(), localPath );
if ( !artifactMetadataFile.exists() /* || user requests snapshot updates */ )
{
String localPath = plugin.getGroupId().replace( '.', '/' ) + "/" + plugin.getArtifactId() + "/maven-metadata-" + repository.getId() + ".xml";
// Search in remote repositories for a version.
//
// maven-metadata-{central|nexus|...}.xml
//
//TODO: we should cycle through the repositories but take the repository which actually
// satisfied the prefix.
for ( ArtifactRepository repository : project.getRemoteArtifactRepositories() )
{
localPath = plugin.getGroupId().replace( '.', '/' ) + "/" + plugin.getArtifactId() + "/maven-metadata-" + repository.getId() + ".xml";
File destination = new File( session.getLocalRepository().getBasedir(), localPath );
artifactMetadataFile = new File( session.getLocalRepository().getBasedir(), localPath );
if ( !destination.exists() )
if ( !artifactMetadataFile.exists() )
{
try
{
String remotePath = plugin.getGroupId().replace( '.', '/' ) + "/" + plugin.getArtifactId() + "/maven-metadata.xml";
repositorySystem.retrieve( repository, destination, remotePath, session.getRequest().getTransferListener() );
repositorySystem.retrieve( repository, artifactMetadataFile, remotePath, session.getRequest().getTransferListener() );
}
catch ( TransferFailedException e )
{
@ -652,11 +696,14 @@ else if ( numTokens == 3 || numTokens == 4 )
continue;
}
}
}
}
// We have retrieved the metadata
if ( artifactMetadataFile.exists() )
{
try
{
Metadata pluginMetadata = readMetadata( destination );
Metadata pluginMetadata = readMetadata( artifactMetadataFile );
String release = pluginMetadata.getVersioning().getRelease();
@ -664,18 +711,55 @@ else if ( numTokens == 3 || numTokens == 4 )
{
plugin.setVersion( release );
}
else
{
String latest = pluginMetadata.getVersioning().getLatest();
if ( latest != null )
{
plugin.setVersion( latest );
}
}
}
catch ( RepositoryMetadataReadException e )
{
logger.warn( "Error reading plugin metadata: ", e );
}
}
else
{
throw new PluginNotFoundException( plugin, null );
}
}
}
return pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), project.getRemoteArtifactRepositories() );
}
private String attemptToGetPluginVersionFromProject( Plugin plugin, MavenProject project )
{
for ( Plugin pluginInPom : project.getBuildPlugins() )
{
if ( pluginInPom.getArtifactId().equals( plugin.getArtifactId() ) )
{
return pluginInPom.getVersion();
}
}
if ( plugin.getVersion() == null && project.getPluginManagement() != null )
{
for ( Plugin pluginInPom : project.getPluginManagement().getPlugins() )
{
if ( pluginInPom.getArtifactId().equals( plugin.getArtifactId() ) )
{
return pluginInPom.getVersion();
}
}
}
return null;
}
public void initialize()
throws InitializationException
{
@ -701,19 +785,6 @@ public void initialize()
}
}
public List<String> getLifecyclePhases()
{
for ( Lifecycle lifecycle : lifecycles )
{
if ( lifecycle.getId().equals( "default" ) )
{
return lifecycle.getPhases();
}
}
return null;
}
// These methods deal with construction intact Plugin object that look like they come from a standard
// <plugin/> block in a Maven POM. We have to do some wiggling to pull the sources of information
// together and this really shows the problem of constructing a sensible default configuration but
@ -798,7 +869,7 @@ private void populateDefaultConfigurationForPlugin( Plugin plugin, ArtifactRepos
{
for( String goal : pluginExecution.getGoals() )
{
Xpp3Dom dom = getDefaultPluginConfiguration( plugin, goal, localRepository, remoteRepositories );
Xpp3Dom dom = getDefaultPluginConfiguration( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), goal, localRepository, remoteRepositories );
pluginExecution.setConfiguration( Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) pluginExecution.getConfiguration(), dom, Boolean.TRUE ) );
}
}
@ -813,14 +884,14 @@ public void populateDefaultConfigurationForPlugins( Collection<Plugin> plugins,
}
}
private Xpp3Dom getDefaultPluginConfiguration( Plugin plugin, String goal, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
private Xpp3Dom getDefaultPluginConfiguration( String groupId, String artifactId, String version, String goal, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws LifecycleExecutionException
{
MojoDescriptor mojoDescriptor;
try
{
mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, localRepository, remoteRepositories );
mojoDescriptor = pluginManager.getMojoDescriptor( groupId, artifactId, version, goal, localRepository, remoteRepositories );
}
catch ( PluginNotFoundException e )
{
@ -902,24 +973,52 @@ public Plugin findPluginForPrefix( String prefix, MavenSession session )
return plugin;
}
for ( ArtifactRepository repository : session.getCurrentProject().getRemoteArtifactRepositories() )
{
// Process all plugin groups in the local repository first to see if we get a hit. A developer may have been
// developing a plugin locally and installing.
//
for ( String pluginGroup : session.getPluginGroups() )
{
// org.apache.maven.plugins
// org/apache/maven/plugins/maven-metadata.xml
String localPath = pluginGroup.replace( '.', '/' ) + "/" + "maven-metadata-" + session.getLocalRepository().getId() + ".xml";
File destination = new File( session.getLocalRepository().getBasedir(), localPath );
if ( destination.exists() )
{
processPluginGroupMetadata( pluginGroup, destination, pluginPrefixes );
plugin = pluginPrefixes.get( prefix );
if ( plugin != null )
{
return plugin;
}
}
}
// Process all the remote repositories.
//
for ( String pluginGroup : session.getPluginGroups() )
{
for ( ArtifactRepository repository : session.getCurrentProject().getRemoteArtifactRepositories() )
{
try
{
String localPath = pluginGroup.replace( '.', '/' ) + "/" + "maven-metadata-" + repository.getId() + ".xml";
File destination = new File( session.getLocalRepository().getBasedir(), localPath );
if ( !destination.exists() )
{
try
{
String remotePath = pluginGroup.replace( '.', '/' ) + "/" + "maven-metadata.xml";
repositorySystem.retrieve( repository, destination, remotePath, session.getRequest().getTransferListener() );
processPluginGroupMetadata( pluginGroup, destination, pluginPrefixes );
plugin = pluginPrefixes.get( prefix );
if ( plugin != null )
{
return plugin;
}
}
catch ( TransferFailedException e )
{
@ -931,10 +1030,32 @@ public Plugin findPluginForPrefix( String prefix, MavenSession session )
}
}
// We have retrieved the metadata
}
throw new NoPluginFoundForPrefixException( prefix, session.getLocalRepository(), session.getCurrentProject().getRemoteArtifactRepositories() );
}
// Keep track of the repository that provided the prefix mapping
//
private class PluginPrefix
{
private Plugin plugin;
private ArtifactRepository repository;
public PluginPrefix( Plugin plugin, ArtifactRepository repository )
{
this.plugin = plugin;
this.repository = repository;
}
}
private void processPluginGroupMetadata( String pluginGroup, File pluginGroupMetadataFile, Map<String,Plugin> pluginPrefixes )
{
try
{
Metadata pluginGroupMetadata = readMetadata( destination );
Metadata pluginGroupMetadata = readMetadata( pluginGroupMetadataFile );
List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins();
@ -954,17 +1075,6 @@ public Plugin findPluginForPrefix( String prefix, MavenSession session )
logger.warn( "Error reading plugin group metadata: ", e );
}
}
}
plugin = pluginPrefixes.get( prefix );
if ( plugin != null )
{
return plugin;
}
throw new NoPluginFoundForPrefixException( prefix );
}
protected Metadata readMetadata( File mappingFile )
throws RepositoryMetadataReadException

View File

@ -39,8 +39,6 @@
*/
public interface LifecycleExecutor
{
List<String> getLifecyclePhases();
/**
* Calculate the list of {@link org.apache.maven.plugin.descriptor.MojoDescriptor} objects to run for the selected lifecycle phase.
*

View File

@ -1,12 +1,23 @@
package org.apache.maven.lifecycle;
import java.util.List;
import org.apache.maven.artifact.repository.ArtifactRepository;
public class NoPluginFoundForPrefixException
extends Exception
{
private String prefix;
public NoPluginFoundForPrefixException( String prefix )
private ArtifactRepository localRepository;
private List<ArtifactRepository> remoteRepositories;
public NoPluginFoundForPrefixException( String prefix, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
{
super( "No plugin found for prefix '" + prefix + "'" );
this.prefix = prefix;
this.localRepository = localRepository;
this.remoteRepositories = remoteRepositories;
}
}

View File

@ -32,7 +32,7 @@
public class PluginNotFoundException
extends AbstractArtifactResolutionException
{
private final Plugin plugin;
private Plugin plugin;
public PluginNotFoundException( Plugin plugin, ArtifactNotFoundException e )
{

View File

@ -41,15 +41,6 @@ protected String getProjectsDirectory()
return "src/test/projects/lifecycle-executor";
}
// -----------------------------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------------------------
public void testLifecyclePhases()
{
assertNotNull( lifecycleExecutor.getLifecyclePhases() );
}
// -----------------------------------------------------------------------------------------------
// Tests which exercise the lifecycle executor when it is dealing with default lifecycle phases.
// -----------------------------------------------------------------------------------------------

View File

@ -252,14 +252,20 @@ else if ( quiet )
.setGlobalChecksumPolicy( globalChecksumPolicy ) // default: warn
.setUserToolchainsFile( userToolchainsFile );
File pom;
if ( alternatePomFile != null )
{
request.setPom( new File( alternatePomFile ) );
pom = new File( alternatePomFile );
}
else
{
request.setPom( new File( baseDirectory, Maven.POMv4 ) );
pom = new File( baseDirectory, Maven.POMv4 );
}
if ( pom.exists() )
{
request.setPom( pom );
}
return request;

View File

@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.List;
import org.apache.maven.Maven;
import org.apache.maven.MavenExecutionException;
@ -549,9 +548,4 @@ public PlexusContainer getPlexusContainer()
{
return container;
}
public List<String> getLifecyclePhases()
{
return maven.getLifecyclePhases();
}
}

View File

@ -94,14 +94,6 @@ public MavenExecutionRequest populateDefaults( MavenExecutionRequest request, Co
private void pom( MavenExecutionRequest request )
{
// ------------------------------------------------------------------------
// POM
//
// If we are not given a specific POM file, but passed a base directory
// then we will use a release POM in the directory provided, and then
// look for the standard POM.
// ------------------------------------------------------------------------
if ( request.getPom() != null && !request.getPom().isAbsolute() )
{
request.setPom( request.getPom().getAbsoluteFile() );

View File

@ -326,22 +326,6 @@ public void testTwoExecutionsDoNotCacheChangedData()
assertEquals( "2.4.3", p.getVersion() );
}
// ----------------------------------------------------------------------
// Lifecycle phases
// ----------------------------------------------------------------------
public void testRetrievingLifecyclePhases()
throws Exception
{
List phases = mavenEmbedder.getLifecyclePhases();
assertEquals( "validate", (String) phases.get( 0 ) );
assertEquals( "initialize", (String) phases.get( 1 ) );
assertEquals( "generate-sources", (String) phases.get( 2 ) );
}
// ----------------------------------------------------------------------
// Repository
// ----------------------------------------------------------------------

View File

@ -64,10 +64,9 @@ public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, Artifact
return userLocalArtifactRepository.pathOfLocalRepositoryMetadata( metadata, userLocalArtifactRepository );
}
// This ID is necessary of the metadata lookup doesn't work correctly.
public String getId()
{
return "delegating";
return "local";
}
@Override