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:08 UTC

[maven] branch master updated (9dd4732 -> 49c8f17)

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git.


    from 9dd4732  Revert "[MNG-6548] Lifecycle plugin version upgrades"
     new 37676a2  [MNG-6599] use version from parent if necessary, like groupId
     new 4bec550  [MNG-6600] add inputlocation tracking for default lifecycle executions
     new 0b10fe7  [MNG-6597] add input location tracking for plugins configuration
     new 49c8f17  [MNG-6601] add input location tracking for m-site-p converted reports

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../internal/DefaultLifecyclePluginAnalyzer.java   | 22 ++++++++-
 .../maven/model/building/ModelProblemUtils.java    |  4 ++
 .../model/plugin/DefaultReportingConverter.java    | 54 +++++++++++++++-------
 .../model/superpom/DefaultSuperPomProvider.java    |  2 +-
 maven-model/pom.xml                                |  1 +
 pom.xml                                            |  4 +-
 6 files changed, 67 insertions(+), 20 deletions(-)


[maven] 02/04: [MNG-6600] add inputlocation tracking for default lifecycle executions

Posted by hb...@apache.org.
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 );


[maven] 01/04: [MNG-6599] use version from parent if necessary, like groupId

Posted by hb...@apache.org.
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 37676a26170be85879273a4c5a019019733ad508
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Fri Feb 22 13:33:43 2019 +0100

    [MNG-6599] use version from parent if necessary, like groupId
---
 .../main/java/org/apache/maven/model/building/ModelProblemUtils.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemUtils.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemUtils.java
index 1b694c4..150d60d 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemUtils.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemUtils.java
@@ -90,6 +90,10 @@ public class ModelProblemUtils
         String artifactId = model.getArtifactId();
 
         String version = model.getVersion();
+        if ( version == null && model.getParent() != null )
+        {
+            version = model.getParent().getVersion();
+        }
         if ( version == null )
         {
             version = "[unknown-version]";


[maven] 04/04: [MNG-6601] add input location tracking for m-site-p converted reports

Posted by hb...@apache.org.
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 49c8f17ed432e5bc1b7fa4bb1711e63f4ec45a55
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sat Feb 23 12:55:25 2019 +0100

    [MNG-6601] add input location tracking for m-site-p converted reports
---
 .../model/plugin/DefaultReportingConverter.java    | 54 +++++++++++++++-------
 1 file changed, 38 insertions(+), 16 deletions(-)

diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
index 8bfa580..683f494 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
@@ -20,6 +20,8 @@ package org.apache.maven.model.plugin;
  */
 
 import org.apache.maven.model.Build;
+import org.apache.maven.model.InputLocation;
+import org.apache.maven.model.InputSource;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.PluginManagement;
@@ -45,6 +47,15 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
 public class DefaultReportingConverter
     implements ReportingConverter
 {
+    private final InputLocation location;
+    {
+        String modelId = "org.apache.maven:maven-model-builder:"
+            + this.getClass().getPackage().getImplementationVersion() + ":reporting-converter";
+        InputSource inputSource = new InputSource();
+        inputSource.setModelId( modelId );
+        location = new InputLocation( -1, -1, inputSource );
+        location.setLocation( 0, location );
+    }
 
     @Override
     public void convertReporting( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
@@ -62,6 +73,7 @@ public class DefaultReportingConverter
         {
             build = new Build();
             model.setBuild( build );
+            model.setLocation( "build", location );
         }
 
         Plugin sitePlugin = findSitePlugin( build );
@@ -70,6 +82,7 @@ public class DefaultReportingConverter
         {
             sitePlugin = new Plugin();
             sitePlugin.setArtifactId( "maven-site-plugin" );
+            sitePlugin.setLocation( "artifactId", location );
             PluginManagement pluginManagement = build.getPluginManagement();
             if ( pluginManagement == null )
             {
@@ -83,7 +96,7 @@ public class DefaultReportingConverter
 
         if ( configuration == null )
         {
-            configuration = new Xpp3Dom( "configuration" );
+            configuration = new Xpp3Dom( "configuration", location );
             sitePlugin.setConfiguration( configuration );
         }
 
@@ -102,10 +115,11 @@ public class DefaultReportingConverter
 
         if ( configuration.getChild( "outputDirectory" ) == null )
         {
-            addDom( configuration, "outputDirectory", reporting.getOutputDirectory() );
+            addDom( configuration, "outputDirectory", reporting.getOutputDirectory(),
+                    reporting.getLocation( "outputDirectory" ) );
         }
 
-        reportPlugins = new Xpp3Dom( "reportPlugins" );
+        reportPlugins = new Xpp3Dom( "reportPlugins", location );
         configuration.addChild( reportPlugins );
 
         boolean hasMavenProjectInfoReportsPlugin = false;
@@ -136,7 +150,7 @@ public class DefaultReportingConverter
 
         if ( !reporting.isExcludeDefaults() && !hasMavenProjectInfoReportsPlugin )
         {
-            Xpp3Dom dom = new Xpp3Dom( "reportPlugin" );
+            Xpp3Dom dom = new Xpp3Dom( "reportPlugin", location );
 
             addDom( dom, "groupId", "org.apache.maven.plugins" );
             addDom( dom, "artifactId", "maven-project-info-reports-plugin" );
@@ -178,11 +192,11 @@ public class DefaultReportingConverter
 
     private Xpp3Dom convert( ReportPlugin plugin )
     {
-        Xpp3Dom dom = new Xpp3Dom( "reportPlugin" );
+        Xpp3Dom dom = new Xpp3Dom( "reportPlugin", plugin.getLocation( "" ) );
 
-        addDom( dom, "groupId", plugin.getGroupId() );
-        addDom( dom, "artifactId", plugin.getArtifactId() );
-        addDom( dom, "version", plugin.getVersion() );
+        addDom( dom, "groupId", plugin.getGroupId(), plugin.getLocation( "groupId" ) );
+        addDom( dom, "artifactId", plugin.getArtifactId(), plugin.getLocation( "artifactId" ) );
+        addDom( dom, "version", plugin.getVersion(), plugin.getLocation( "version" ) );
 
         Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
         if ( configuration != null )
@@ -193,7 +207,7 @@ public class DefaultReportingConverter
 
         if ( !plugin.getReportSets().isEmpty() )
         {
-            Xpp3Dom reportSets = new Xpp3Dom( "reportSets" );
+            Xpp3Dom reportSets = new Xpp3Dom( "reportSets", plugin.getLocation( "reportSets" ) );
             for ( ReportSet reportSet : plugin.getReportSets() )
             {
                 Xpp3Dom rs = convert( reportSet );
@@ -207,9 +221,10 @@ public class DefaultReportingConverter
 
     private Xpp3Dom convert( ReportSet reportSet )
     {
-        Xpp3Dom dom = new Xpp3Dom( "reportSet" );
+        Xpp3Dom dom = new Xpp3Dom( "reportSet", reportSet.getLocation( "" ) );
 
-        addDom( dom, "id", reportSet.getId() );
+        InputLocation idLocation = reportSet.getLocation( "id" );
+        addDom( dom, "id", reportSet.getId(), idLocation == null ? location : idLocation );
 
         Xpp3Dom configuration = (Xpp3Dom) reportSet.getConfiguration();
         if ( configuration != null )
@@ -220,10 +235,12 @@ public class DefaultReportingConverter
 
         if ( !reportSet.getReports().isEmpty() )
         {
-            Xpp3Dom reports = new Xpp3Dom( "reports" );
+            InputLocation location = reportSet.getLocation( "reports" );
+            Xpp3Dom reports = new Xpp3Dom( "reports", location );
+            int n = 0;
             for ( String report : reportSet.getReports() )
             {
-                addDom( reports, "report", report );
+                addDom( reports, "report", report, location.getLocation( n++ ) );
             }
             dom.addChild( reports );
         }
@@ -233,15 +250,20 @@ public class DefaultReportingConverter
 
     private void addDom( Xpp3Dom parent, String childName, String childValue )
     {
+        addDom( parent, childName, childValue, location );
+    }
+
+    private void addDom( Xpp3Dom parent, String childName, String childValue, InputLocation location )
+    {
         if ( StringUtils.isNotEmpty( childValue ) )
         {
-            parent.addChild( newDom( childName, childValue ) );
+            parent.addChild( newDom( childName, childValue, location ) );
         }
     }
 
-    private Xpp3Dom newDom( String name, String value )
+    private Xpp3Dom newDom( String name, String value, InputLocation location )
     {
-        Xpp3Dom dom = new Xpp3Dom( name );
+        Xpp3Dom dom = new Xpp3Dom( name, location );
         dom.setValue( value );
         return dom;
     }


[maven] 03/04: [MNG-6597] add input location tracking for plugins configuration

Posted by hb...@apache.org.
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 0b10fe75a57c8b690444ca7a3262d02b7487b27c
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Thu Feb 21 23:36:27 2019 +0100

    [MNG-6597] add input location tracking for plugins configuration
    
    add also xpp3-extended-writer directly in Maven core
---
 maven-model/pom.xml | 1 +
 pom.xml             | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/maven-model/pom.xml b/maven-model/pom.xml
index 86c11df..d6059c7 100644
--- a/maven-model/pom.xml
+++ b/maven-model/pom.xml
@@ -63,6 +63,7 @@ under the License.
               <goal>xpp3-reader</goal>
               <goal>xpp3-extended-reader</goal>
               <goal>xpp3-writer</goal>
+              <goal>xpp3-extended-writer</goal>
             </goals>
           </execution>
         </executions>
diff --git a/pom.xml b/pom.xml
index 11b3de8..df0f29e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,13 +56,13 @@ under the License.
     <mockitoVersion>2.21.0</mockitoVersion>
     <plexusVersion>1.7.1</plexusVersion>
     <plexusInterpolationVersion>1.25</plexusInterpolationVersion>
-    <plexusUtilsVersion>3.1.0</plexusUtilsVersion>
+    <plexusUtilsVersion>3.2.0</plexusUtilsVersion>
     <guiceVersion>4.2.1</guiceVersion>
     <sisuInjectVersion>0.3.3</sisuInjectVersion>
     <wagonVersion>3.3.2</wagonVersion>
     <securityDispatcherVersion>1.4</securityDispatcherVersion>
     <cipherVersion>1.7</cipherVersion>
-    <modelloVersion>1.9.1</modelloVersion>
+    <modelloVersion>1.10.0</modelloVersion>
     <jxpathVersion>1.3</jxpathVersion>
     <resolverVersion>1.3.1</resolverVersion>
     <slf4jVersion>1.7.25</slf4jVersion>