You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2018/01/06 00:50:51 UTC

[maven-plugin-tools] 01/02: [MPLUGIN-331] Check the existence of plugin.xml rather than project packaging in PluginReport.canGenerateReport()

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 <pp...@redhat.com>
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
"commits@maven.apache.org" <co...@maven.apache.org>.

Re: [maven-plugin-tools] 01/02: [MPLUGIN-331] Check the existence of plugin.xml rather than project packaging in PluginReport.canGenerateReport()

Posted by Hervé BOUTEMY <he...@free.fr>.
in fact, this update is done for situation where the report documents plugins 
not created with Maven Plugin Tools: perhaps the other build tool may change 
the location of generated plugins.xml

IMHO, this has to be discussed with the issue reporter: I don't know if the 
parameter is only a way to define easily a constant or if he really expects to 
change the value by configuring the plugin
Both situations may have a reasonable meaning to me.

Regards,

Hervé

Le samedi 6 janvier 2018, 13:20:50 CET Robert Scholte a écrit :
> I would like to see this as a readOnly parameter. Changing it value will
> break things.
> 
> On Sat, 06 Jan 2018 01:50:51 +0100, <hb...@apache.org> wrote:
> > +    @Parameter( defaultValue =
> > "${project.build.outputDirectory}/META-INF/maven/plugin.xml", required =
> > true )
> > +    private File pluginXmlFile;
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [maven-plugin-tools] 01/02: [MPLUGIN-331] Check the existence of plugin.xml rather than project packaging in PluginReport.canGenerateReport()

Posted by Robert Scholte <rf...@apache.org>.
I would like to see this as a readOnly parameter. Changing it value will  
break things.

On Sat, 06 Jan 2018 01:50:51 +0100, <hb...@apache.org> wrote:

> +    @Parameter( defaultValue =  
> "${project.build.outputDirectory}/META-INF/maven/plugin.xml", required =  
> true )
> +    private File pluginXmlFile;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org