You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2008/07/14 14:42:55 UTC

svn commit: r676573 - in /maven/plugins/trunk/maven-project-info-reports-plugin/src/main: java/org/apache/maven/report/projectinfo/ resources/

Author: vsiveton
Date: Mon Jul 14 05:42:54 2008
New Revision: 676573

URL: http://svn.apache.org/viewvc?rev=676573&view=rev
Log:
o removed todo and changed canGenerateReport() impl
o be sure that plugin's version comes from repo
o updated getPluginRow()
o removed report.pluginManagement.nolist key

Modified:
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_pt_BR.properties
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_sv.properties
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_tr.properties

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java?rev=676573&r1=676572&r2=676573&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java Mon Jul 14 05:42:54 2008
@@ -39,6 +39,7 @@
 import org.apache.maven.report.projectinfo.dependencies.ArtifactUtils;
 import org.apache.maven.reporting.AbstractMavenReportRenderer;
 import org.codehaus.plexus.i18n.I18N;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * Generates the Project Plugin Management report.
@@ -105,7 +106,8 @@
     /** {@inheritDoc} */
     public boolean canGenerateReport()
     {
-        return project.getPluginManagement() != null;
+        return project.getPluginManagement() != null && project.getPluginManagement().getPlugins() != null
+            && !project.getPluginManagement().getPlugins().isEmpty();
     }
 
     // ----------------------------------------------------------------------
@@ -120,11 +122,11 @@
     protected static class PluginManagementRenderer
         extends AbstractMavenReportRenderer
     {
-        private List plugins;
+        private final List pluginManagement;
 
         private final Locale locale;
 
-        private I18N i18n;
+        private final I18N i18n;
 
         private final MavenProject project;
 
@@ -154,7 +156,7 @@
 
             this.locale = locale;
 
-            this.plugins = plugins;
+            this.pluginManagement = plugins;
 
             this.i18n = i18n;
 
@@ -181,21 +183,7 @@
         /** {@inheritDoc} */
         public void renderBody()
         {
-            // Dependencies report
-
-            if ( plugins.isEmpty() )
-            {
-                startSection( getTitle() );
-
-                // TODO: should the report just be excluded?
-                paragraph( getReportString( "report.pluginManagement.nolist" ) );
-
-                endSection();
-
-                return;
-            }
-
-            // === Section: Project Dependencies.
+            // === Section: Project PluginManagement.
             renderSectionPluginManagement();
         }
 
@@ -205,50 +193,48 @@
 
             startSection( getTitle() );
 
-            if ( plugins != null )
-            {
-                // can't use straight artifact comparison because we want optional last
-                Collections.sort( plugins, getPluginComparator() );
+            // can't use straight artifact comparison because we want optional last
+            Collections.sort( pluginManagement, getPluginComparator() );
 
-                startTable();
-                tableHeader( tableHeader );
+            startTable();
+            tableHeader( tableHeader );
 
-                for ( Iterator iterator = plugins.iterator(); iterator.hasNext(); )
+            for ( Iterator iterator = pluginManagement.iterator(); iterator.hasNext(); )
+            {
+                Plugin plugin = (Plugin) iterator.next();
+                VersionRange versionRange;
+                if ( StringUtils.isEmpty( plugin.getVersion() ) )
                 {
-                    Plugin plugin = (Plugin) iterator.next();
-                    VersionRange versionRange;
-                    if ( plugin.getVersion() == null || "".equals( plugin.getVersion() ) )
-                    {
-                        versionRange = VersionRange.createFromVersion( Artifact.RELEASE_VERSION );
-                    }
-                    else
-                    {
-                        versionRange = VersionRange.createFromVersion( plugin.getVersion() );
-                    }
-
-                    Artifact pluginArtifact = artifactFactory.createParentArtifact( plugin.getGroupId(), plugin
-                        .getArtifactId(), versionRange.toString() );
-                    List artifactRepositories = project.getPluginArtifactRepositories();
-                    if ( artifactRepositories == null )
-                    {
-                        artifactRepositories = new ArrayList();
-                    }
-                    try
-                    {
-                        MavenProject pluginProject = mavenProjectBuilder.buildFromRepository( pluginArtifact,
-                                                                                              artifactRepositories,
-                                                                                              localRepository );
-                        tableRow( getPluginRow( plugin, pluginProject.getUrl() ) );
-                    }
-                    catch ( ProjectBuildingException e )
-                    {
-                        log.info( "Could not build project for: " + plugin.getArtifactId() + ":" + e.getMessage(), e );
-                        tableRow( getPluginRow( plugin, null ) );
-                    }
+                    versionRange = VersionRange.createFromVersion( Artifact.RELEASE_VERSION );
+                }
+                else
+                {
+                    versionRange = VersionRange.createFromVersion( plugin.getVersion() );
+                }
 
+                Artifact pluginArtifact = artifactFactory.createParentArtifact( plugin.getGroupId(), plugin
+                    .getArtifactId(), versionRange.toString() );
+                List artifactRepositories = project.getPluginArtifactRepositories();
+                if ( artifactRepositories == null )
+                {
+                    artifactRepositories = new ArrayList();
+                }
+                try
+                {
+                    MavenProject pluginProject = mavenProjectBuilder.buildFromRepository( pluginArtifact,
+                                                                                          artifactRepositories,
+                                                                                          localRepository );
+                    tableRow( getPluginRow( pluginProject.getGroupId(), pluginProject.getArtifactId(), pluginProject
+                        .getVersion(), pluginProject.getUrl() ) );
                 }
-                endTable();
+                catch ( ProjectBuildingException e )
+                {
+                    log.info( "Could not build project for: " + plugin.getArtifactId() + ":" + e.getMessage(), e );
+                    tableRow( getPluginRow( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null ) );
+                }
+
             }
+            endTable();
 
             endSection();
         }
@@ -265,10 +251,10 @@
             return new String[] { groupId, artifactId, version };
         }
 
-        private String[] getPluginRow( Plugin plugin, String link )
+        private String[] getPluginRow( String groupId, String artifactId, String version, String link )
         {
-            String artifactId = ArtifactUtils.getArtifactIdCell( plugin.getArtifactId(), link );
-            return new String[] { plugin.getGroupId(), artifactId, plugin.getVersion() };
+            artifactId = ArtifactUtils.getArtifactIdCell( artifactId, link );
+            return new String[] { groupId, artifactId, version };
         }
 
         private Comparator getPluginComparator()

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties?rev=676573&r1=676572&r2=676573&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties Mon Jul 14 05:42:54 2008
@@ -235,4 +235,3 @@
 report.pluginManagement.name                                       = Plugin Management
 report.pluginManagement.description                                = This document lists the plugins that are defined through pluginManagement.
 report.pluginManagement.title                                      = Project Plugin Management
-report.pluginManagement.nolist                                     = There are no plugins in the PluginManagement of this project.

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_pt_BR.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_pt_BR.properties?rev=676573&r1=676572&r2=676573&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_pt_BR.properties (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_pt_BR.properties Mon Jul 14 05:42:54 2008
@@ -235,4 +235,3 @@
 report.pluginManagement.name                                       = Ger\u00eancia de Plugins
 report.pluginManagement.description                                = Este documento lista os plugins que s\u00e3o definidos atrav\u00e9s do pluginManagement.
 report.pluginManagement.title                                      = Ger\u00eancia de Plugins do Projeto
-report.pluginManagement.nolist                                     = N\u00e3o h\u00e1 plugins no pluginManagement deste projeto.

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_sv.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_sv.properties?rev=676573&r1=676572&r2=676573&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_sv.properties (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_sv.properties Mon Jul 14 05:42:54 2008
@@ -234,4 +234,3 @@
 report.pluginManagement.name                                       = Pluginhantering
 report.pluginManagement.description                                = Detta dokument listar de plugins som definierats genom pluginManagement.
 report.pluginManagement.title                                      = Pluginhantering f\u00f6r projektet
-report.pluginManagement.nolist                                     = Det finns inga plugins i projektets pluginhantering.

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_tr.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_tr.properties?rev=676573&r1=676572&r2=676573&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_tr.properties (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_tr.properties Mon Jul 14 05:42:54 2008
@@ -232,4 +232,3 @@
 report.pluginManagement.name                                       = Plugin Management
 report.pluginManagement.description                                = This document lists the plugins that are defined through pluginManagement.
 report.pluginManagement.title                                      = Project Plugin Management
-report.pluginManagement.nolist                                     = There are no plugins in the PluginManagement of this project.