maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1479081 - in /maven/plugins/trunk/maven-pdf-plugin: pom.xml src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
Date Sat, 04 May 2013 11:43:00 GMT
Author: rfscholte
Date: Sat May  4 11:43:00 2013
New Revision: 1479081

URL: http://svn.apache.org/r1479081
Log:
[MPDF-48] make PDF plugin run reports when used with Maven 3 
introduce maven-reporting-exec

Modified:
    maven/plugins/trunk/maven-pdf-plugin/pom.xml
    maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java

Modified: maven/plugins/trunk/maven-pdf-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/pom.xml?rev=1479081&r1=1479080&r2=1479081&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-pdf-plugin/pom.xml Sat May  4 11:43:00 2013
@@ -82,6 +82,17 @@ under the License.
   </dependencyManagement>
 
   <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.reporting</groupId>
+      <artifactId>maven-reporting-api</artifactId>
+      <version>3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.reporting</groupId>
+      <artifactId>maven-reporting-exec</artifactId>
+      <version>1.1</version>
+    </dependency>
+  
     <!-- maven -->
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -131,11 +142,6 @@ under the License.
     </dependency>
     <dependency>
       <groupId>org.apache.maven.reporting</groupId>
-      <artifactId>maven-reporting-api</artifactId>
-      <version>${mavenVersion}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.reporting</groupId>
       <artifactId>maven-reporting-impl</artifactId>
       <version>2.0.4.3</version>
     </dependency>

Modified: maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java?rev=1479081&r1=1479080&r2=1479081&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
(original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
Sat May  4 11:43:00 2013
@@ -95,7 +95,12 @@ import org.apache.maven.reporting.MavenR
 import org.apache.maven.reporting.MavenReportException;
 import org.apache.maven.settings.Settings;
 import org.codehaus.classworlds.ClassRealm;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
 import org.codehaus.plexus.i18n.I18N;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.PathTool;
@@ -112,7 +117,7 @@ import org.codehaus.plexus.util.xml.pull
  */
 @Mojo( name = "pdf", threadSafe = true )
 public class PdfMojo
-    extends AbstractMojo
+    extends AbstractMojo implements Contextualizable
 {
     /**
      * The vm line separator
@@ -305,6 +310,27 @@ public class PdfMojo
      */
     @Parameter( property = "validate", defaultValue = "false" )
     private boolean validate;
+    
+    /**
+     * Reports (Maven 2).
+     * @since 1.3
+     */
+    @Parameter( defaultValue = "${reports}", required = true, readonly = true )
+    private List<MavenReport> reports;
+    
+    /**
+     * <p>Configuration section <b>used internally</b> by Maven 3.</p>
+     * <p>More details available here:
+     * <a href="http://maven.apache.org/plugins/maven-site-plugin/maven-3.html#Configuration_formats"
target="_blank">
+     * http://maven.apache.org/plugins/maven-site-plugin/maven-3.html#Configuration_formats</a>
+     * </p>
+     * <p><b>Note:</b> using this field is not mandatory with Maven 3 as
Maven core injects usual
+     * <code>&lt;reporting&gt;</code> section into this field.</p>
+     *
+     * @since 1.3
+     */
+    @Parameter( readonly = true )
+    private org.apache.maven.reporting.exec.ReportPlugin[] reportPlugins;
 
     // ----------------------------------------------------------------------
     // Instance fields
@@ -351,6 +377,11 @@ public class PdfMojo
      * @since 1.1
      */
     private Map<Locale, List<MavenReport>> generatedMavenReports;
+    
+    /**
+     * @since 1.3
+     */
+    private PlexusContainer container;
 
     // ----------------------------------------------------------------------
     // Public methods
@@ -382,6 +413,13 @@ public class PdfMojo
             throw new MojoExecutionException( "Error copying generated PDF: " + e.getMessage(),
e );
         }
     }
+    
+    /** {@inheritDoc} */
+    public void contextualize( Context context )
+        throws ContextException
+    {
+        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+    }
 
     // ----------------------------------------------------------------------
     // Private methods



Mime
View raw message