mirror of
https://github.com/apache/maven.git
synced 2025-02-22 10:00:09 +00:00
[MNG-6600] add inputlocation tracking for default lifecycle executions
This commit is contained in:
parent
37676a2617
commit
4bec5502d5
@ -25,6 +25,8 @@
|
||||
import org.apache.maven.lifecycle.mapping.LifecycleMapping;
|
||||
import org.apache.maven.lifecycle.mapping.LifecycleMojo;
|
||||
import org.apache.maven.lifecycle.mapping.LifecyclePhase;
|
||||
import org.apache.maven.model.InputLocation;
|
||||
import org.apache.maven.model.InputSource;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
@ -150,6 +152,13 @@ public int compare( Lifecycle l1, Lifecycle l2 )
|
||||
|
||||
private void parseLifecyclePhaseDefinitions( Map<Plugin, Plugin> plugins, String phase, LifecyclePhase goals )
|
||||
{
|
||||
String modelId = "org.apache.maven:maven-core:" + this.getClass().getPackage().getImplementationVersion()
|
||||
+ ":default-lifecycle-bindings";
|
||||
InputSource inputSource = new InputSource();
|
||||
inputSource.setModelId( modelId );
|
||||
InputLocation location = new InputLocation( -1, -1, inputSource );
|
||||
location.setLocation( 0, location );
|
||||
|
||||
List<LifecycleMojo> mojos = goals.getMojos();
|
||||
if ( mojos != null )
|
||||
{
|
||||
@ -166,11 +175,16 @@ private void parseLifecyclePhaseDefinitions( Map<Plugin, Plugin> plugins, String
|
||||
+ "' from lifecycle mapping for phase " + phase );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Plugin plugin = new Plugin();
|
||||
plugin.setGroupId( gs.groupId );
|
||||
plugin.setArtifactId( gs.artifactId );
|
||||
plugin.setVersion( gs.version );
|
||||
|
||||
plugin.setLocation( "", location );
|
||||
plugin.setLocation( "groupId", location );
|
||||
plugin.setLocation( "artifactId", location );
|
||||
plugin.setLocation( "version", location );
|
||||
|
||||
Plugin existing = plugins.get( plugin );
|
||||
if ( existing != null )
|
||||
@ -178,6 +192,7 @@ private void parseLifecyclePhaseDefinitions( Map<Plugin, Plugin> plugins, String
|
||||
if ( existing.getVersion() == null )
|
||||
{
|
||||
existing.setVersion( plugin.getVersion() );
|
||||
existing.setLocation( "version", location );
|
||||
}
|
||||
plugin = existing;
|
||||
}
|
||||
@ -192,6 +207,11 @@ private void parseLifecyclePhaseDefinitions( Map<Plugin, Plugin> plugins, String
|
||||
execution.setPriority( i - mojos.size() );
|
||||
execution.getGoals().add( gs.goal );
|
||||
|
||||
execution.setLocation( "", location );
|
||||
execution.setLocation( "id", location );
|
||||
execution.setLocation( "phase", location );
|
||||
execution.setLocation( "goals", location );
|
||||
|
||||
Xpp3Dom lifecycleConfiguration = mojo.getConfiguration();
|
||||
if ( lifecycleConfiguration != null )
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ public Model getSuperModel( String version )
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
options.put( "xml:4.0.0", "xml:4.0.0" );
|
||||
|
||||
String modelId = "org.apache.maven:model-builder:"
|
||||
String modelId = "org.apache.maven:maven-model-builder:"
|
||||
+ this.getClass().getPackage().getImplementationVersion() + ":super-pom";
|
||||
InputSource inputSource = new InputSource();
|
||||
inputSource.setModelId( modelId );
|
||||
|
Loading…
x
Reference in New Issue
Block a user