You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/02/21 20:14:57 UTC

[maven-project-info-reports-plugin] branch master updated: [MPIR-413] Plugin repositories defined in project are not used by plugin management report

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

michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-project-info-reports-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new d28e98b  [MPIR-413] Plugin repositories defined in project are not used by plugin management report
d28e98b is described below

commit d28e98b8cfedbe179a1017d1a221871919841415
Author: Piotrek Żygieło <pz...@users.noreply.github.com>
AuthorDate: Sun Feb 20 22:51:30 2022 +0100

    [MPIR-413] Plugin repositories defined in project are not used by plugin management report
    
    This closes #32
---
 .../report/projectinfo/PluginManagementReport.java     | 14 +++++++-------
 .../apache/maven/report/projectinfo/PluginsReport.java | 18 +++++-------------
 2 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java b/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java
index cddd113..05ae58d 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java
@@ -53,17 +53,17 @@ import java.util.Locale;
 public class PluginManagementReport
     extends AbstractProjectInfoReport
 {
-    
+
     /**
      * Specify the excluded plugins. This can be a list of artifacts in the format
      * groupId[:artifactId[:type[:version]]]. <br>
      * Plugins matching any exclude will not be present in the report.
-     * 
+     *
      * @since 3.0.1
      */
     @Parameter
     private List<String> pluginManagementExcludes = null;
-    
+
     // ----------------------------------------------------------------------
     // Public methods
     // ----------------------------------------------------------------------
@@ -128,7 +128,7 @@ public class PluginManagementReport
         private final RepositorySystem repositorySystem;
 
         private final ProjectBuildingRequest buildingRequest;
-        
+
         private final PatternExcludesArtifactFilter patternExcludesArtifactFilter;
 
         /**
@@ -206,7 +206,7 @@ public class PluginManagementReport
 
             ProjectBuildingRequest buildRequest = new DefaultProjectBuildingRequest( buildingRequest );
             buildRequest.setRemoteRepositories( project.getPluginArtifactRepositories() );
-            
+
             for ( Plugin plugin : pluginManagement )
             {
                 VersionRange versionRange;
@@ -227,14 +227,14 @@ public class PluginManagementReport
                     try
                     {
                         MavenProject pluginProject =
-                            projectBuilder.build( pluginArtifact, buildingRequest ).getProject();
+                            projectBuilder.build( pluginArtifact, buildRequest ).getProject();
 
                         tableRow( getPluginRow( pluginProject.getGroupId(), pluginProject.getArtifactId(),
                                                 pluginProject.getVersion(), pluginProject.getUrl() ) );
                     }
                     catch ( ProjectBuildingException e )
                     {
-                        log.info( "Could not build project for: " + plugin.getArtifactId() + ":" + e.getMessage(), e );
+                        log.info( "Could not build project for " + plugin.getArtifactId(), e );
                         tableRow( getPluginRow( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
                                                 null ) );
                     }
diff --git a/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java b/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java
index b831c91..9570c77 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/PluginsReport.java
@@ -26,7 +26,6 @@ import java.util.List;
 import java.util.Locale;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.model.Plugin;
@@ -173,7 +172,7 @@ public class PluginsReport
         private void renderSectionPlugins( boolean isPlugins )
         {
             List<GAV> list = isPlugins ? GAV.pluginsToGAV( plugins ) : GAV.reportPluginsToGAV( reports, project );
-            
+
             String[] tableHeader = getPluginTableHeader();
 
             startSection( getI18nString( isPlugins ? "build.title" : "report.title" ) );
@@ -191,20 +190,14 @@ public class PluginsReport
             startTable();
             tableHeader( tableHeader );
 
-            List<ArtifactRepository> artifactRepositories = project.getPluginArtifactRepositories();
-            if ( artifactRepositories == null )
-            {
-                artifactRepositories = new ArrayList<>();
-            }
-
             ProjectBuildingRequest buildRequest = new DefaultProjectBuildingRequest( buildingRequest );
-            buildRequest.setRemoteRepositories( artifactRepositories );
-            
+            buildRequest.setRemoteRepositories( project.getPluginArtifactRepositories() );
+
             for ( GAV plugin : list )
             {
                 VersionRange versionRange = VersionRange.createFromVersion( plugin.getVersion() );
 
-                
+
                 Artifact pluginArtifact =
                                 repositorySystem.createProjectArtifact( plugin.getGroupId(), plugin.getArtifactId(),
                                                           versionRange.toString() );
@@ -217,11 +210,10 @@ public class PluginsReport
                 }
                 catch ( ProjectBuildingException e )
                 {
-                    log.info( "Could not build project for " + plugin.getArtifactId() + ": " + e.getMessage(), e );
+                    log.info( "Could not build project for " + plugin.getArtifactId(), e );
                     tableRow( getPluginRow( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
                                             null ) );
                 }
-
             }
             endTable();