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 2014/12/08 21:51:46 UTC

svn commit: r1643913 - in /maven/plugins/trunk/maven-project-info-reports-plugin/src: it/full-pom/ it/minimal-pom/ main/java/org/apache/maven/report/projectinfo/ main/resources/

Author: michaelo
Date: Mon Dec  8 20:51:46 2014
New Revision: 1643913

URL: http://svn.apache.org/r1643913
Log:
[MPIR-288] Add a skipEmptyReport option

* Resolved a few TODOs
* Adapted full-/minimal-pom IT for fixed reports

Modified:
    maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/pom.xml
    maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/verify.bsh
    maven/plugins/trunk/maven-project-info-reports-plugin/src/it/minimal-pom/verify.bsh
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java
    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/java/org/apache/maven/report/projectinfo/ProjectIndexPageReport.java
    maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.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_de.properties

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/pom.xml?rev=1643913&r1=1643912&r2=1643913&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/pom.xml (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/pom.xml Mon Dec  8 20:51:46 2014
@@ -201,6 +201,7 @@
               <report>dependency-info</report>
               <report>dependency-management</report>
               <report>dependencies</report>
+              <report>dependency-convergence</report>
               <report>cim</report>
               <report>plugin-management</report>
               <report>plugins</report>

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/verify.bsh?rev=1643913&r1=1643912&r2=1643913&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/verify.bsh (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/it/full-pom/verify.bsh Mon Dec  8 20:51:46 2014
@@ -41,6 +41,7 @@ try
                          "dependency-info",        // <report>dependency-info</report>
                          "dependency-management",  // <report>dependency-management</report>
                          "dependencies",           // <report>dependencies</report>
+                         "dependency-convergence", // <report>dependency-convergence</report>
                          "integration",            // <report>cim</report>
                          "plugin-management",      // <report>plugin-management</report>
                          "plugins",                // <report>plugins</report>

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/it/minimal-pom/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/it/minimal-pom/verify.bsh?rev=1643913&r1=1643912&r2=1643913&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/it/minimal-pom/verify.bsh (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/it/minimal-pom/verify.bsh Mon Dec  8 20:51:46 2014
@@ -46,7 +46,8 @@ try
                                 "source-repository",
                                 "dependency-management",
                                 "team-list",
-                                "distribution-management"
+                                "distribution-management",
+                                "modules"
                               };
 
     for ( String report : reports )

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java?rev=1643913&r1=1643912&r2=1643913&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependencyConvergenceReport.java Mon Dec  8 20:51:46 2014
@@ -119,14 +119,6 @@ public class DependencyConvergenceReport
     // Public methods
     // ----------------------------------------------------------------------
 
-    @Override
-    public boolean canGenerateReport()
-    {
-        // TODO Add a noconvergence property string aligned with the other reports
-        // should generate the convergency report, even its single Maven project.
-        return super.canGenerateReport() && reactorProjects.size() >= 1;
-    }
-
     /** {@inheritDoc} */
     public String getOutputName()
     {

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java?rev=1643913&r1=1643912&r2=1643913&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java Mon Dec  8 20:51:46 2014
@@ -21,6 +21,7 @@ package org.apache.maven.report.projecti
 
 import java.io.File;
 import java.net.MalformedURLException;
+import java.util.List;
 import java.util.Locale;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -51,6 +52,18 @@ public class ModulesReport
     // ----------------------------------------------------------------------
 
     @Override
+    public boolean canGenerateReport()
+    {
+        boolean result = super.canGenerateReport();
+        if ( result && skipEmptyReport )
+        {
+            result = !isEmpty( getProject().getModel().getModules() ) ;
+        }
+
+        return result;
+    }
+
+    @Override
     public void executeReport( Locale locale )
     {
         new ModulesRenderer( getSink(), getProject(), mavenProjectBuilder, localRepository,
@@ -69,13 +82,6 @@ public class ModulesReport
         return "modules";
     }
 
-    @Override
-    public boolean canGenerateReport()
-    {
-        // TODO Add a nomodules property string aligned with the other reports
-        return !isEmpty( getProject().getModel().getModules() );
-    }
-
     // ----------------------------------------------------------------------
     // Private
     // ----------------------------------------------------------------------
@@ -115,6 +121,19 @@ public class ModulesReport
         @Override
         public void renderBody()
         {
+            List<String> modules = project.getModel().getModules();
+
+            if ( modules == null || modules.isEmpty() )
+             {
+                 startSection( getTitle() );
+
+                 paragraph( getI18nString( "nolist" ) );
+
+                 endSection();
+
+                 return;
+             }
+
             startSection( getTitle() );
 
             paragraph( getI18nString( "intro" ) );
@@ -127,7 +146,7 @@ public class ModulesReport
 
             final String baseUrl = getDistMgmntSiteUrl( project );
 
-            for ( Object module : project.getModules() )
+            for ( String module : modules )
             {
                 Model moduleModel;
                 File f = new File( project.getBasedir(), module + "/pom.xml" );
@@ -145,8 +164,8 @@ public class ModulesReport
                 else
                 {
                     moduleModel = new Model();
-                    moduleModel.setName( module.toString() );
-                    setDistMgmntSiteUrl( moduleModel, module.toString() );
+                    moduleModel.setName( module );
+                    setDistMgmntSiteUrl( moduleModel, module );
                 }
 
                 final String moduleName =

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=1643913&r1=1643912&r2=1643913&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 Dec  8 20:51:46 2014
@@ -25,6 +25,7 @@ import org.apache.maven.artifact.reposit
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Mojo;
@@ -97,9 +98,14 @@ public class PluginManagementReport
     @Override
     public boolean canGenerateReport()
     {
-        // TODO Add a nopluginmanagement property string aligned with the other reports
-        return super.canGenerateReport() && project.getPluginManagement() != null
-            && !isEmpty( project.getPluginManagement().getPlugins() );
+          boolean result = super.canGenerateReport();
+          if ( result && skipEmptyReport )
+          {
+              result = getProject().getPluginManagement() != null
+                      && !isEmpty( project.getPluginManagement().getPlugins() );
+          }
+
+          return result;
     }
 
     // ----------------------------------------------------------------------
@@ -165,6 +171,20 @@ public class PluginManagementReport
         @Override
         public void renderBody()
         {
+            PluginManagement pluginManagement = project.getPluginManagement();
+
+            if ( pluginManagement == null || pluginManagement.getPlugins() == null
+                || pluginManagement.getPlugins().isEmpty() )
+            {
+                startSection( getTitle() );
+
+                paragraph( getI18nString( "nolist" ) );
+
+                endSection();
+
+                return;
+            }
+
             // === Section: Project PluginManagement.
             renderSectionPluginManagement();
         }

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectIndexPageReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectIndexPageReport.java?rev=1643913&r1=1643912&r2=1643913&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectIndexPageReport.java (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectIndexPageReport.java Mon Dec  8 20:51:46 2014
@@ -130,7 +130,7 @@ public class ProjectIndexPageReport
 
             paragraph( description );
 
-            if ( !project.getModules().isEmpty() )
+            if ( !project.getModel().getModules().isEmpty() )
             {
                 modules = true;
                 super.renderBody();

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java?rev=1643913&r1=1643912&r2=1643913&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java Mon Dec  8 20:51:46 2014
@@ -213,19 +213,9 @@ public class ScmReport
         public void renderBody()
         {
             Scm scm = model.getScm();
-            if ( scm == null )
-            {
-                startSection( getTitle() );
-
-                paragraph( getI18nString( "noscm" ) );
-
-                endSection();
-
-                return;
-            }
-
-            if ( StringUtils.isEmpty( anonymousConnection ) && StringUtils.isEmpty( devConnection )
-                && StringUtils.isEmpty( scm.getUrl() ) )
+            if ( scm == null || StringUtils.isEmpty( anonymousConnection )
+                                && StringUtils.isEmpty( devConnection )
+                                && StringUtils.isEmpty( scm.getUrl() ) )
             {
                 startSection( getTitle() );
 

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=1643913&r1=1643912&r2=1643913&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 Dec  8 20:51:46 2014
@@ -264,6 +264,7 @@ report.dependencyManagement.intro.provid
 report.dependencyManagement.intro.runtime                          = The following is a list of runtime dependencies in the DependencyManagement of this project. These dependencies can be included in the submodules to run the submodule:
 report.dependencyManagement.intro.system                           = The following is a list of system dependencies in the DependencyManagement of this project. These dependencies can be included in the submodules to compile the submodule:
 report.dependencyManagement.intro.test                             = The following is a list of test dependencies in the DependencyManagement of this project. These dependencies can be included in the submodules to compile and run unit tests for the submodule:
+report.pluginManagement.nolist                                     = There are no plugins defined in the PluginManagement part of this project.
 report.pluginManagement.name                                       = Plugin Management
 report.pluginManagement.description                                = This document lists the plugins that are defined through pluginManagement.
 report.pluginManagement.title                                      = Project Plugin Management
@@ -273,6 +274,7 @@ report.plugins.title
 report.plugins.report.title                                        = Project Report Plugins
 report.plugins.nolist                                              = There are no plugins defined in the Build part of this project.
 report.plugins.report.nolist                                       = There are no plugins reports defined in the Reporting part of this project.
+report.modules.nolist                                              = There are no modules declared in this project.
 report.modules.name                                                = Project Modules
 report.modules.description                                         = This document lists the modules (sub-projects) of this project.
 report.modules.title                                               = Project Modules

Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_de.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_de.properties?rev=1643913&r1=1643912&r2=1643913&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_de.properties (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_de.properties Mon Dec  8 20:51:46 2014
@@ -257,6 +257,7 @@ report.dependencyManagement.intro.provid
 report.dependencyManagement.intro.runtime                          = Es folgt eine Liste der Laufzeitabh\u00e4ngigkeiten dieses Projektes, die durch Dependency-Management kontrolliert werden:
 report.dependencyManagement.intro.system                           = Es folgt eine Liste der Systemabh\u00e4ngigkeiten dieses Projektes, die durch Dependency-Management kontrolliert werden:
 report.dependencyManagement.intro.test                             = Es folgt eine Liste der Testabh\u00e4ngigkeiten dieses Projektes, die durch Dependency-Management kontrolliert werden:
+report.pluginManagement.nolist                                     = F\u00fcr dieses Projekt sind keine Plugins zur Verwaltung definiert.
 report.pluginManagement.name                                       = Plugin-Management
 report.pluginManagement.description                                = Informationen \u00fcber die verwalteten Plugins.
 report.pluginManagement.title                                      = Plugin-Management
@@ -266,6 +267,7 @@ report.plugins.title
 report.plugins.report.title                                        = Report-Plugins
 report.plugins.nolist                                              = F\u00fcr dieses Projekt sind keine Build-Plugins definiert.
 report.plugins.report.nolist                                       = F\u00fcr dieses Projekt sind keine Report-Plugins definiert.
+report.modules.nolist                                              = F\u00fcr dieses Projekt sind keine Module definiert.
 report.modules.name                                                = Projekt Module
 report.modules.description                                         = Informationen \u00fcber die Module (Unter-Projekte) dieses Projektes.
 report.modules.title                                               = Projekt Module