From 03e3a1d4c3dd0d3bda5cdd7fad020dee68c14169 Mon Sep 17 00:00:00 2001 From: Benson Margulies Date: Fri, 2 Sep 2011 13:31:56 +0000 Subject: [PATCH] [MPLUGIN-168] Plugins with no mojos lead to exception and failure in PluginReport git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1164525 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/plugin/plugin/PluginReport.java | 18 ++++++++++++------ .../main/resources/plugin-report.properties | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java index 75b1e16..8b75539 100644 --- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java +++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java @@ -172,6 +172,7 @@ public class PluginReport } /** {@inheritDoc} */ + @SuppressWarnings( "unchecked" ) protected void executeReport( Locale locale ) throws MavenReportException { @@ -216,7 +217,16 @@ public class PluginReport PluginToolsRequest request = new DefaultPluginToolsRequest( project, pluginDescriptor ); request.setEncoding( encoding ); - mojoScanner.populatePluginDescriptor( request ); + try + { + mojoScanner.populatePluginDescriptor( request ); + } + catch ( InvalidPluginDescriptorException e ) + { + // this is OK, it happens to lifecycle plugins. Allow generation to proceed. + getLog().debug( "Plugin without mojos.", e ); + + } // Generate the plugin's documentation generatePluginDocumentation( pluginDescriptor, locale ); @@ -226,11 +236,7 @@ public class PluginReport locale ); r.render(); } - catch ( InvalidPluginDescriptorException e ) - { - throw new MavenReportException( "Error extracting plugin descriptor: \'" + e.getLocalizedMessage() + "\'", - e ); - } + catch ( ExtractionException e ) { throw new MavenReportException( "Error extracting plugin descriptor: \'" + e.getLocalizedMessage() + "\'", diff --git a/maven-plugin-plugin/src/main/resources/plugin-report.properties b/maven-plugin-plugin/src/main/resources/plugin-report.properties index 528ee05..01ee9b3 100644 --- a/maven-plugin-plugin/src/main/resources/plugin-report.properties +++ b/maven-plugin-plugin/src/main/resources/plugin-report.properties @@ -21,7 +21,7 @@ report.plugin.name=Plugin Documentation report.plugin.description=This report provides goals and parameters documentation of a plugin. report.plugin.title=Plugin Documentation -report.plugin.goals.nogoal=No goals available yet. +report.plugin.goals.nogoal=No goals defined in this plugin. report.plugin.goals.intro=Goals available for this plugin: report.plugin.goals.column.goal=Goal report.plugin.goals.column.isMavenReport=Report?