Author: hboutemy
Date: Sun Mar 19 22:18:45 2017
New Revision: 1787667

URL: http://svn.apache.org/viewvc?rev=1787667&view=rev
Log:
[MSHARED-628] support maven-model ReportPlugin in addition to local copy

Modified:
    maven/shared/trunk/maven-reporting-exec/pom.xml
    
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/MavenReportExecutorRequest.java
    
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportPlugin.java
    
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportSet.java
    maven/shared/trunk/maven-reporting-exec/src/site/apt/index.apt.vm

Modified: maven/shared/trunk/maven-reporting-exec/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-reporting-exec/pom.xml?rev=1787667&r1=1787666&r2=1787667&view=diff
==============================================================================
--- maven/shared/trunk/maven-reporting-exec/pom.xml (original)
+++ maven/shared/trunk/maven-reporting-exec/pom.xml Sun Mar 19 22:18:45 2017
@@ -29,7 +29,7 @@
 
   <groupId>org.apache.maven.reporting</groupId>
   <artifactId>maven-reporting-exec</artifactId>
-  <version>1.3.1-SNAPSHOT</version>
+  <version>1.4-SNAPSHOT</version>
 
   <name>Apache Maven Reporting Executor</name>
   <description>Classes to manage report plugin executions with Maven 
3.</description>

Modified: 
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/MavenReportExecutorRequest.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/MavenReportExecutorRequest.java?rev=1787667&r1=1787666&r2=1787667&view=diff
==============================================================================
--- 
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/MavenReportExecutorRequest.java
 (original)
+++ 
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/MavenReportExecutorRequest.java
 Sun Mar 19 22:18:45 2017
@@ -19,9 +19,14 @@ package org.apache.maven.reporting.exec;
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
 
 /**
  * Bean which contains necessary informations to build {@link 
MavenReportExecution} with {@link MavenReportExecutor}: 
@@ -79,4 +84,44 @@ public class MavenReportExecutorRequest
     {
         this.reportPlugins = reportPlugins;
     }
+
+    /**
+     * Set the report plugin directly from 
<code>${project.reporting.plugins}</code> parameter value.
+     *
+     * @param reportPlugins the report plugins from 
<code>&lt;reporting&gt;</code> section
+     * @since 1.4
+     */
+    public void setReportPlugins( org.apache.maven.model.ReportPlugin[] 
reportPlugins )
+    {
+        setReportPlugins( new ReportPlugin[reportPlugins.length] );
+
+        int i = 0;
+        for ( org.apache.maven.model.ReportPlugin r : reportPlugins )
+        {
+            ReportPlugin p = new ReportPlugin();
+            p.setGroupId( r.getGroupId() );
+            p.setArtifactId( r.getArtifactId() );
+            p.setVersion( r.getVersion() );
+            if ( r.getConfiguration() != null )
+            {
+                p.setConfiguration( new XmlPlexusConfiguration( (Xpp3Dom) 
r.getConfiguration() ) );
+            }
+
+            List<ReportSet> prs = new ArrayList<ReportSet>();
+            for ( org.apache.maven.model.ReportSet rs : r.getReportSets() )
+            {
+                ReportSet ps = new ReportSet();
+                ps.setId( rs.getId() );
+                ps.setReports( rs.getReports() );
+                if ( rs.getConfiguration() != null )
+                {
+                    ps.setConfiguration( new XmlPlexusConfiguration( (Xpp3Dom) 
rs.getConfiguration() ) );
+                }
+                prs.add( ps );
+            }
+            p.setReportSets( prs );
+
+            this.reportPlugins[i++] = p;
+        }
+    }
 }

Modified: 
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportPlugin.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportPlugin.java?rev=1787667&r1=1787666&r2=1787667&view=diff
==============================================================================
--- 
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportPlugin.java
 (original)
+++ 
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportPlugin.java
 Sun Mar 19 22:18:45 2017
@@ -27,7 +27,9 @@ import org.codehaus.plexus.configuration
 
 /**
  * Represents a reporting plugin and its execution configuration. It basically 
contains similar informations as a
- * {@link org.apache.maven.model.Plugin}, but in order to decouple reporting 
stuff from core, some values are copied.
+ * {@link org.apache.maven.model.ReportPlugin}, but in order to decouple 
reporting stuff from core,
+ * some values are copied.
+ * @see org.apache.maven.model.ReportPlugin
  */
 public class ReportPlugin
 {

Modified: 
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportSet.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportSet.java?rev=1787667&r1=1787666&r2=1787667&view=diff
==============================================================================
--- 
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportSet.java
 (original)
+++ 
maven/shared/trunk/maven-reporting-exec/src/main/java/org/apache/maven/reporting/exec/ReportSet.java
 Sun Mar 19 22:18:45 2017
@@ -26,6 +26,7 @@ import org.codehaus.plexus.configuration
 
 /**
  * Represents a set of reports and a configuration to be used to generate them.
+ * @see org.apache.maven.model.ReportSet
  */
 public class ReportSet
 {

Modified: maven/shared/trunk/maven-reporting-exec/src/site/apt/index.apt.vm
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-reporting-exec/src/site/apt/index.apt.vm?rev=1787667&r1=1787666&r2=1787667&view=diff
==============================================================================
--- maven/shared/trunk/maven-reporting-exec/src/site/apt/index.apt.vm (original)
+++ maven/shared/trunk/maven-reporting-exec/src/site/apt/index.apt.vm Sun Mar 
19 22:18:45 2017
@@ -37,7 +37,7 @@ ${project.name}
 
 +----+
 <reportPlugins>
-  <plugin>
+  <reportPlugin>
     <groupId/>
     <artifactId/>
     <version/>
@@ -50,7 +50,7 @@ ${project.name}
         <reports/>
       </reportSet>
     </reportSets>
-  </plugin>
+  </reportPlugin>
 </reportPlugins>
 +----+
 
@@ -82,3 +82,32 @@ ${project.name}
   to <<<maven-site-plugin>>>'s <<<reportPlugins>>> configuration through the
   
{{{/ref/current/maven-model-builder/apidocs/org/apache/maven/model/plugin/ReportingConverter.html}ReportingConverter}}
   component.
+
+  Since 1.4, the request can be populated from pom's<<<\<reporting\>>>> 
section,
+  injected as <<<$\{project.reporting.plugins\}>>> parameter value:
+
++----+
+<project>
+  [...]
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId/>
+        <artifactId/>
+        <version/>
+        <configuration/>
+        <reportSets>
+          <reportSet>
+            <id/>
+            <configuration/>
+            <reports/>
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugin>
+    [...]
+  </reporting>
+</project>
++----+
+
+  
\ No newline at end of file


Reply via email to