mirror of https://github.com/apache/maven.git
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:
parent
5cde8bfe4b
commit
864ea15216
|
@ -64,11 +64,6 @@ public class DefaultMaven
|
||||||
@Requirement
|
@Requirement
|
||||||
protected PlexusContainer container;
|
protected PlexusContainer container;
|
||||||
|
|
||||||
public List<String> getLifecyclePhases()
|
|
||||||
{
|
|
||||||
return lifecycleExecutor.getLifecyclePhases();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MavenExecutionResult execute( MavenExecutionRequest request )
|
public MavenExecutionResult execute( MavenExecutionRequest request )
|
||||||
{
|
{
|
||||||
//TODO: Need a general way to inject standard properties
|
//TODO: Need a general way to inject standard properties
|
||||||
|
@ -93,7 +88,7 @@ public class DefaultMaven
|
||||||
|
|
||||||
try
|
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
|
//TODO: We really need to get rid of this requirement in here. If we know there is no project present
|
||||||
if ( projects.isEmpty() )
|
if ( projects.isEmpty() )
|
||||||
|
@ -171,7 +166,7 @@ public class DefaultMaven
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String,MavenProject> getProjects( MavenExecutionRequest request )
|
protected Map<String,MavenProject> getProjectsForMavenReactor( MavenExecutionRequest request )
|
||||||
throws MavenExecutionException, ProjectBuildingException
|
throws MavenExecutionException, ProjectBuildingException
|
||||||
{
|
{
|
||||||
// We have no POM file.
|
// We have no POM file.
|
||||||
|
|
|
@ -19,8 +19,6 @@ package org.apache.maven;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenExecutionResult;
|
import org.apache.maven.execution.MavenExecutionResult;
|
||||||
|
|
||||||
|
@ -32,6 +30,4 @@ public interface Maven
|
||||||
String POMv4 = "pom.xml";
|
String POMv4 = "pom.xml";
|
||||||
|
|
||||||
MavenExecutionResult execute( MavenExecutionRequest request );
|
MavenExecutionResult execute( MavenExecutionRequest request );
|
||||||
|
|
||||||
List<String> getLifecyclePhases();
|
|
||||||
}
|
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -68,14 +68,8 @@ import org.codehaus.plexus.util.StringUtils;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
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
|
//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.
|
||||||
// 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: 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
|
* @author Jason van Zyl
|
||||||
|
@ -92,23 +86,32 @@ public class DefaultLifecycleExecutor
|
||||||
@Requirement
|
@Requirement
|
||||||
protected RepositorySystem repositorySystem;
|
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
|
@Requirement
|
||||||
private ProjectDependenciesResolver projectDependenciesResolver;
|
private ProjectDependenciesResolver projectDependenciesResolver;
|
||||||
|
|
||||||
// @Configuration(source="org/apache/maven/lifecycle/lifecycles.xml")
|
// @Configuration(source="org/apache/maven/lifecycle/lifecycles.xml")
|
||||||
private List<Lifecycle> lifecycles;
|
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;
|
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;
|
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 )
|
public void execute( MavenSession session )
|
||||||
{
|
{
|
||||||
// TODO: Use a listener here instead of loggers
|
// TODO: Use a listener here instead of loggers
|
||||||
|
@ -216,29 +219,61 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 )
|
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
|
||||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, PluginManagerException
|
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, PluginManagerException
|
||||||
{
|
{
|
||||||
MavenProject project = session.getCurrentProject();
|
MavenProject project = session.getCurrentProject();
|
||||||
|
|
||||||
List<MojoExecution> phasesWithMojosToExecute = new ArrayList<MojoExecution>();
|
|
||||||
|
|
||||||
List<MojoExecution> lifecyclePlan = new ArrayList<MojoExecution>();
|
List<MojoExecution> lifecyclePlan = new ArrayList<MojoExecution>();
|
||||||
|
|
||||||
String requiredDependencyResolutionScope = null;
|
String requiredDependencyResolutionScope = null;
|
||||||
|
|
||||||
for ( String task : tasks )
|
for ( String task : tasks )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( task.indexOf( ":" ) > 0 )
|
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>
|
// <project>
|
||||||
// <modelVersion>4.0.0</modelVersion>
|
// <modelVersion>4.0.0</modelVersion>
|
||||||
// <groupId>org.apache.maven.plugins</groupId>
|
// <groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -267,9 +302,7 @@ public class DefaultLifecycleExecutor
|
||||||
// - attach that to the MojoExecution for its configuration
|
// - attach that to the MojoExecution for its configuration
|
||||||
// - give the MojoExecution an id of default-<goal>.
|
// - give the MojoExecution an id of default-<goal>.
|
||||||
|
|
||||||
MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session );
|
MojoDescriptor mojoDescriptor = getMojoDescriptor( goal, session );
|
||||||
|
|
||||||
requiredDependencyResolutionScope = mojoDescriptor.isDependencyResolutionRequired();
|
|
||||||
|
|
||||||
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, "default-" + mojoDescriptor.getGoal() );
|
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, "default-" + mojoDescriptor.getGoal() );
|
||||||
|
|
||||||
|
@ -277,13 +310,22 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
lifecyclePlan.add( mojoExecution );
|
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.
|
// 1.
|
||||||
//
|
//
|
||||||
// Based on the lifecycle phase we are given, let's find the corresponding lifecycle.
|
// 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.
|
// 2.
|
||||||
//
|
//
|
||||||
|
@ -379,39 +421,14 @@ public class DefaultLifecycleExecutor
|
||||||
//
|
//
|
||||||
for ( String phase : phaseToMojoMapping.keySet() )
|
for ( String phase : phaseToMojoMapping.keySet() )
|
||||||
{
|
{
|
||||||
phasesWithMojosToExecute.addAll( phaseToMojoMapping.get( phase ) );
|
lifecyclePlan.addAll( phaseToMojoMapping.get( phase ) );
|
||||||
|
|
||||||
if ( phase.equals( task ) )
|
if ( phase.equals( lifecyclePhase ) )
|
||||||
{
|
{
|
||||||
break;
|
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_COMPILE
|
||||||
// SCOPE_TEST
|
// SCOPE_TEST
|
||||||
|
@ -567,10 +584,49 @@ public class DefaultLifecycleExecutor
|
||||||
Plugin plugin = null;
|
Plugin plugin = null;
|
||||||
|
|
||||||
StringTokenizer tok = new StringTokenizer( task, ":" );
|
StringTokenizer tok = new StringTokenizer( task, ":" );
|
||||||
|
|
||||||
int numTokens = tok.countTokens();
|
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 )
|
if ( numTokens == 2 )
|
||||||
{
|
{
|
||||||
|
// We have a prefix and goal
|
||||||
|
//
|
||||||
|
// idea:idea
|
||||||
|
//
|
||||||
String prefix = tok.nextToken();
|
String prefix = tok.nextToken();
|
||||||
goal = tok.nextToken();
|
goal = tok.nextToken();
|
||||||
|
|
||||||
|
@ -585,63 +641,51 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
plugin = findPluginForPrefix( prefix, 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 )
|
if ( plugin.getVersion() == null )
|
||||||
{
|
{
|
||||||
// We need to get it from the POM first before anything else
|
// We need to get it from the POM first before anything else
|
||||||
//
|
//
|
||||||
for ( Plugin pluginInPom : project.getBuildPlugins() )
|
plugin.setVersion( attemptToGetPluginVersionFromProject( plugin, project ) );
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there is no version to be found then we need to look in the repository metadata for
|
// 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.
|
// this plugin and see what's specified as the latest release.
|
||||||
//
|
//
|
||||||
if ( plugin.getVersion() == null )
|
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
|
try
|
||||||
{
|
{
|
||||||
String remotePath = plugin.getGroupId().replace( '.', '/' ) + "/" + plugin.getArtifactId() + "/maven-metadata.xml";
|
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 )
|
catch ( TransferFailedException e )
|
||||||
{
|
{
|
||||||
|
@ -652,11 +696,14 @@ public class DefaultLifecycleExecutor
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We have retrieved the metadata
|
if ( artifactMetadataFile.exists() )
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Metadata pluginMetadata = readMetadata( destination );
|
Metadata pluginMetadata = readMetadata( artifactMetadataFile );
|
||||||
|
|
||||||
String release = pluginMetadata.getVersioning().getRelease();
|
String release = pluginMetadata.getVersioning().getRelease();
|
||||||
|
|
||||||
|
@ -664,18 +711,55 @@ public class DefaultLifecycleExecutor
|
||||||
{
|
{
|
||||||
plugin.setVersion( release );
|
plugin.setVersion( release );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String latest = pluginMetadata.getVersioning().getLatest();
|
||||||
|
|
||||||
|
if ( latest != null )
|
||||||
|
{
|
||||||
|
plugin.setVersion( latest );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch ( RepositoryMetadataReadException e )
|
catch ( RepositoryMetadataReadException e )
|
||||||
{
|
{
|
||||||
logger.warn( "Error reading plugin metadata: ", e );
|
logger.warn( "Error reading plugin metadata: ", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new PluginNotFoundException( plugin, null );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), project.getRemoteArtifactRepositories() );
|
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()
|
public void initialize()
|
||||||
throws InitializationException
|
throws InitializationException
|
||||||
{
|
{
|
||||||
|
@ -701,19 +785,6 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
// 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
|
// <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
|
// together and this really shows the problem of constructing a sensible default configuration but
|
||||||
|
@ -798,7 +869,7 @@ public class DefaultLifecycleExecutor
|
||||||
{
|
{
|
||||||
for( String goal : pluginExecution.getGoals() )
|
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 ) );
|
pluginExecution.setConfiguration( Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) pluginExecution.getConfiguration(), dom, Boolean.TRUE ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -813,14 +884,14 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
throws LifecycleExecutionException
|
||||||
{
|
{
|
||||||
MojoDescriptor mojoDescriptor;
|
MojoDescriptor mojoDescriptor;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, localRepository, remoteRepositories );
|
mojoDescriptor = pluginManager.getMojoDescriptor( groupId, artifactId, version, goal, localRepository, remoteRepositories );
|
||||||
}
|
}
|
||||||
catch ( PluginNotFoundException e )
|
catch ( PluginNotFoundException e )
|
||||||
{
|
{
|
||||||
|
@ -902,24 +973,52 @@ public class DefaultLifecycleExecutor
|
||||||
return plugin;
|
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() )
|
for ( String pluginGroup : session.getPluginGroups() )
|
||||||
{
|
{
|
||||||
// org.apache.maven.plugins
|
String localPath = pluginGroup.replace( '.', '/' ) + "/" + "maven-metadata-" + session.getLocalRepository().getId() + ".xml";
|
||||||
// org/apache/maven/plugins/maven-metadata.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";
|
String localPath = pluginGroup.replace( '.', '/' ) + "/" + "maven-metadata-" + repository.getId() + ".xml";
|
||||||
|
|
||||||
File destination = new File( session.getLocalRepository().getBasedir(), localPath );
|
File destination = new File( session.getLocalRepository().getBasedir(), localPath );
|
||||||
|
|
||||||
if ( !destination.exists() )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
String remotePath = pluginGroup.replace( '.', '/' ) + "/" + "maven-metadata.xml";
|
String remotePath = pluginGroup.replace( '.', '/' ) + "/" + "maven-metadata.xml";
|
||||||
|
|
||||||
repositorySystem.retrieve( repository, destination, remotePath, session.getRequest().getTransferListener() );
|
repositorySystem.retrieve( repository, destination, remotePath, session.getRequest().getTransferListener() );
|
||||||
|
|
||||||
|
processPluginGroupMetadata( pluginGroup, destination, pluginPrefixes );
|
||||||
|
|
||||||
|
plugin = pluginPrefixes.get( prefix );
|
||||||
|
|
||||||
|
if ( plugin != null )
|
||||||
|
{
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch ( TransferFailedException e )
|
catch ( TransferFailedException e )
|
||||||
{
|
{
|
||||||
|
@ -931,10 +1030,32 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
try
|
||||||
{
|
{
|
||||||
Metadata pluginGroupMetadata = readMetadata( destination );
|
Metadata pluginGroupMetadata = readMetadata( pluginGroupMetadataFile );
|
||||||
|
|
||||||
List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins();
|
List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins();
|
||||||
|
|
||||||
|
@ -954,17 +1075,6 @@ public class DefaultLifecycleExecutor
|
||||||
logger.warn( "Error reading plugin group metadata: ", e );
|
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 )
|
protected Metadata readMetadata( File mappingFile )
|
||||||
throws RepositoryMetadataReadException
|
throws RepositoryMetadataReadException
|
||||||
|
|
|
@ -39,8 +39,6 @@ import org.apache.maven.plugin.PluginResolutionException;
|
||||||
*/
|
*/
|
||||||
public interface LifecycleExecutor
|
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.
|
* Calculate the list of {@link org.apache.maven.plugin.descriptor.MojoDescriptor} objects to run for the selected lifecycle phase.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
package org.apache.maven.lifecycle;
|
package org.apache.maven.lifecycle;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
|
||||||
public class NoPluginFoundForPrefixException
|
public class NoPluginFoundForPrefixException
|
||||||
extends Exception
|
extends Exception
|
||||||
{
|
{
|
||||||
private String prefix;
|
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 + "'" );
|
super( "No plugin found for prefix '" + prefix + "'" );
|
||||||
|
this.prefix = prefix;
|
||||||
|
this.localRepository = localRepository;
|
||||||
|
this.remoteRepositories = remoteRepositories;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.maven.model.Plugin;
|
||||||
public class PluginNotFoundException
|
public class PluginNotFoundException
|
||||||
extends AbstractArtifactResolutionException
|
extends AbstractArtifactResolutionException
|
||||||
{
|
{
|
||||||
private final Plugin plugin;
|
private Plugin plugin;
|
||||||
|
|
||||||
public PluginNotFoundException( Plugin plugin, ArtifactNotFoundException e )
|
public PluginNotFoundException( Plugin plugin, ArtifactNotFoundException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,15 +41,6 @@ public class LifecycleExecutorTest
|
||||||
return "src/test/projects/lifecycle-executor";
|
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.
|
// Tests which exercise the lifecycle executor when it is dealing with default lifecycle phases.
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -252,14 +252,20 @@ public final class CLIRequestUtils
|
||||||
.setGlobalChecksumPolicy( globalChecksumPolicy ) // default: warn
|
.setGlobalChecksumPolicy( globalChecksumPolicy ) // default: warn
|
||||||
.setUserToolchainsFile( userToolchainsFile );
|
.setUserToolchainsFile( userToolchainsFile );
|
||||||
|
|
||||||
|
File pom;
|
||||||
|
|
||||||
if ( alternatePomFile != null )
|
if ( alternatePomFile != null )
|
||||||
{
|
{
|
||||||
request.setPom( new File( alternatePomFile ) );
|
pom = new File( alternatePomFile );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
request.setPom( new File( baseDirectory, Maven.POMv4 ) );
|
pom = new File( baseDirectory, Maven.POMv4 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pom.exists() )
|
||||||
|
{
|
||||||
|
request.setPom( pom );
|
||||||
}
|
}
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.Maven;
|
import org.apache.maven.Maven;
|
||||||
import org.apache.maven.MavenExecutionException;
|
import org.apache.maven.MavenExecutionException;
|
||||||
|
@ -549,9 +548,4 @@ public class MavenEmbedder
|
||||||
{
|
{
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getLifecyclePhases()
|
|
||||||
{
|
|
||||||
return maven.getLifecyclePhases();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,14 +94,6 @@ public class DefaultMavenExecutionRequestPopulator
|
||||||
|
|
||||||
private void pom( MavenExecutionRequest request )
|
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() )
|
if ( request.getPom() != null && !request.getPom().isAbsolute() )
|
||||||
{
|
{
|
||||||
request.setPom( request.getPom().getAbsoluteFile() );
|
request.setPom( request.getPom().getAbsoluteFile() );
|
||||||
|
|
|
@ -326,22 +326,6 @@ public class MavenEmbedderTest
|
||||||
assertEquals( "2.4.3", p.getVersion() );
|
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
|
// Repository
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
|
@ -64,10 +64,9 @@ public class DelegatingLocalArtifactRepository
|
||||||
return userLocalArtifactRepository.pathOfLocalRepositoryMetadata( metadata, userLocalArtifactRepository );
|
return userLocalArtifactRepository.pathOfLocalRepositoryMetadata( metadata, userLocalArtifactRepository );
|
||||||
}
|
}
|
||||||
|
|
||||||
// This ID is necessary of the metadata lookup doesn't work correctly.
|
|
||||||
public String getId()
|
public String getId()
|
||||||
{
|
{
|
||||||
return "delegating";
|
return "local";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue