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-plugin-tools.git
commit 839eb57e20f0c43356d0055c40724c13da48b975 Author: Peter Palaga <[email protected]> AuthorDate: Fri Jan 5 08:05:46 2018 +0100 [MPLUGIN-331] Check the existence of plugin.xml rather than project packaging in PluginReport.canGenerateReport() --- .../org/apache/maven/plugin/plugin/PluginReport.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 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 553af0e..aafdcda 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 @@ -198,6 +198,14 @@ public class PluginReport private RuntimeInformation rtInfo; /** + * Path to {@code plugin.xml} plugin descriptor to generate the report from. + * + * @since 3.5.1 + */ + @Parameter( defaultValue = "${project.build.outputDirectory}/META-INF/maven/plugin.xml", required = true ) + private File pluginXmlFile; + + /** * {@inheritDoc} */ protected Renderer getSiteRenderer() @@ -227,7 +235,7 @@ public class PluginReport */ public boolean canGenerateReport() { - return "maven-plugin".equals( project.getPackaging() ); + return pluginXmlFile != null && pluginXmlFile.isFile() && pluginXmlFile.canRead(); } /** @@ -264,16 +272,15 @@ public class PluginReport try { - return builder.build( new FileReader( new File( project.getBuild().getOutputDirectory(), - "META-INF/maven/plugin.xml" ) ) ); + return builder.build( new FileReader( pluginXmlFile ) ); } catch ( FileNotFoundException e ) { - getLog().debug( "Failed to read META-INF/maven/plugin.xml, fall back to mojoScanner" ); + getLog().debug( "Failed to read " + pluginXmlFile + ", fall back to mojoScanner" ); } catch ( PlexusConfigurationException e ) { - getLog().debug( "Failed to read META-INF/maven/plugin.xml, fall back to mojoScanner" ); + getLog().debug( "Failed to read " + pluginXmlFile + ", fall back to mojoScanner" ); } // Copy from AbstractGeneratorMojo#execute() -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
