From 81eb53a1c50a55bb7b13b975e374e03fb42bd1bc Mon Sep 17 00:00:00 2001 From: Herve Boutemy Date: Sat, 14 Jan 2017 03:54:45 +0000 Subject: [PATCH] [MPLUGIN-319] added references to MNG-6109 bug git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1778718 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/plugin/plugin/PluginReport.java | 21 ++++++++++++++----- 1 file changed, 16 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 8c085fe..e6c350e 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 @@ -197,11 +197,13 @@ public class PluginReport private RuntimeInformation rtInfo; /** - * By default pluginXml should be read with Maven-3.4.0+ (MNG-6109) - * For some integration-tests this is not an issue, they can reduce this spec. + * META-INF/maven/plugin.xml should be read with Maven-3.4.0+ to get accurate + * since (MNG-6109). + * For cases where missing since info is not an issue, this version range spec can be changed + * to avoid parsing code once again. (notice: should not mark readonly = true in this case...) */ - @Parameter( readonly = true ) - private String pluginXmlSpec = "(3.3.9,)"; + @Parameter( defaultValue = "(3.3.9,)", readonly = true ) + private String pluginXmlSpec; /** * {@inheritDoc} @@ -266,7 +268,11 @@ public class PluginReport private PluginDescriptor extractPluginDescriptor() throws MavenReportException { - if ( usePluginXml() ) + if ( !usePluginXml() ) + { + getLog().debug( "Running a Maven version with MNG-6109 bug: fall back to mojoScanner to get accurate @since" ); + } + else { PluginDescriptorBuilder builder = new PluginDescriptorBuilder(); try @@ -338,6 +344,11 @@ public class PluginReport return pluginDescriptor; } + /** + * Check if META-INF/maven/plugin.xml can be read accurately, or if it will trigger MNG-6109 bug + * @return true if running Maven version is fixed + * @see https://issues.apache.org/jira/browse/MNG-6109 + */ private boolean usePluginXml() { try