You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2019/03/11 22:45:10 UTC
[maven] 02/04: [MNG-6600] add inputlocation tracking for default
lifecycle executions
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
commit 4bec5502d53134d33d7c3f194fdb3873079a8f41
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Fri Feb 22 23:30:33 2019 +0100
[MNG-6600] add inputlocation tracking for default lifecycle executions
---
.../internal/DefaultLifecyclePluginAnalyzer.java | 22 +++++++++++++++++++++-
.../model/superpom/DefaultSuperPomProvider.java | 2 +-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java
index 14653b7..67a9057 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java
@@ -25,6 +25,8 @@ import org.apache.maven.lifecycle.Lifecycle;
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 class DefaultLifecyclePluginAnalyzer
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 @@ public class DefaultLifecyclePluginAnalyzer
+ "' 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 @@ public class DefaultLifecyclePluginAnalyzer
if ( existing.getVersion() == null )
{
existing.setVersion( plugin.getVersion() );
+ existing.setLocation( "version", location );
}
plugin = existing;
}
@@ -192,6 +207,11 @@ public class DefaultLifecyclePluginAnalyzer
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 )
{
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java b/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
index a69ec2f..03554c7 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
@@ -74,7 +74,7 @@ public class DefaultSuperPomProvider
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 );