[ 
https://issues.apache.org/jira/browse/MPLUGIN-331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16314238#comment-16314238
 ] 

ASF GitHub Bot commented on MPLUGIN-331:
----------------------------------------

asfgit closed pull request #10: [MPLUGIN-331] Let plugin:report support 
takari-maven-plugin packaging
URL: https://github.com/apache/maven-plugin-tools/pull/10
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 553af0e1..1193e109 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,9 +197,18 @@
     @Component
     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}
      */
+    @Override
     protected Renderer getSiteRenderer()
     {
         return siteRenderer;
@@ -208,6 +217,7 @@ protected Renderer getSiteRenderer()
     /**
      * {@inheritDoc}
      */
+    @Override
     protected String getOutputDirectory()
     {
         // PLUGIN-191: output directory of plugin.html, not *-mojo.xml
@@ -217,6 +227,7 @@ protected String getOutputDirectory()
     /**
      * {@inheritDoc}
      */
+    @Override
     protected MavenProject getProject()
     {
         return project;
@@ -225,14 +236,16 @@ protected MavenProject getProject()
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean canGenerateReport()
     {
-        return "maven-plugin".equals( project.getPackaging() );
+        return pluginXmlFile != null && pluginXmlFile.isFile() && 
pluginXmlFile.canRead();
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     protected void executeReport( Locale locale )
         throws MavenReportException
     {
@@ -264,16 +277,15 @@ private PluginDescriptor extractPluginDescriptor()
         
         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()
@@ -365,6 +377,7 @@ private PluginDescriptorBuilder getPluginDescriptorBuilder()
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getDescription( Locale locale )
     {
         return getBundle( locale ).getString( "report.plugin.description" );
@@ -373,6 +386,7 @@ public String getDescription( Locale locale )
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getName( Locale locale )
     {
         return getBundle( locale ).getString( "report.plugin.name" );
@@ -381,6 +395,7 @@ public String getName( Locale locale )
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getOutputName()
     {
         return "plugin-info";
@@ -460,6 +475,7 @@ public PluginOverviewRenderer( MavenProject project, 
Requirements requirements,
         /**
          * {@inheritDoc}
          */
+        @Override
         public String getTitle()
         {
             return getBundle( locale ).getString( "report.plugin.title" );
@@ -468,6 +484,7 @@ public String getTitle()
         /**
          * {@inheritDoc}
          */
+        @Override
         @SuppressWarnings( { "unchecked", "rawtypes" } )
         public void renderBody()
         {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Check the existence of plugin.xml rather than project packaging in 
> PluginReport.canGenerateReport()
> ---------------------------------------------------------------------------------------------------
>
>                 Key: MPLUGIN-331
>                 URL: https://issues.apache.org/jira/browse/MPLUGIN-331
>             Project: Maven Plugin Tools
>          Issue Type: Task
>          Components: Plugin Plugin
>            Reporter: Peter Palaga
>             Fix For: 3.5.1
>
>
> {{org.apache.maven.plugin.plugin.PluginReport.canGenerateReport()}} currently 
> reads
> {code}
> return "maven-plugin".equals( project.getPackaging() );
> {code}
> I propose to change it to 
> {code}
> return "maven-plugin".equals( project.getPackaging() )
>                 || "takari-maven-plugin".equals( project.getPackaging() );
> {code}
> so that also takari-maven-plugins are supported.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to