You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2009/06/07 15:53:06 UTC

svn commit: r782390 - in /maven/plugins/trunk/maven-pdf-plugin/src: main/java/org/apache/maven/plugins/pdf/ site/apt/ test/java/org/apache/maven/plugins/pdf/ test/resources/unit/pdf/

Author: vsiveton
Date: Sun Jun  7 13:53:05 2009
New Revision: 782390

URL: http://svn.apache.org/viewvc?rev=782390&view=rev
Log:
MPDF-15: New parameter to generate aggregate document and individual documents

o added new aggregate parameter and use logic from r782388
o updated test case and documentation

Modified:
    maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
    maven/plugins/trunk/maven-pdf-plugin/src/site/apt/usage.apt
    maven/plugins/trunk/maven-pdf-plugin/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java
    maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/iText_pom.xml
    maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom.xml
    maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom_filtering.xml

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=782390&r1=782389&r2=782390&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 Sun Jun  7 13:53:05 2009
@@ -198,6 +198,14 @@
     private ArtifactRepository localRepository;
 
     /**
+     * If <code>true</false>, aggregate all source documents in one pdf, otherwise generate one pdf for each
+     * source document.
+     *
+     * @parameter default-value="true"
+     */
+    private boolean aggregate;
+
+    /**
      * Document Renderer.
      */
     private DocumentRenderer docRenderer;
@@ -256,7 +264,14 @@
                 // Copy extra-resources
                 copyResources( locale );
 
-                docRenderer.render( siteDirectoryFile, workingDir, getDocumentModel( locale ) );
+                if ( aggregate )
+                {
+                    docRenderer.render( siteDirectoryFile, workingDir, getDocumentModel( locale ) );
+                }
+                else
+                {
+                    docRenderer.render( siteDirectoryFile, workingDir, null );
+                }
             }
 
             if ( !outputDirectory.getCanonicalPath().equals( workingDirectory.getCanonicalPath() ) )

Modified: maven/plugins/trunk/maven-pdf-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/site/apt/usage.apt?rev=782390&r1=782389&r2=782390&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/site/apt/usage.apt (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/site/apt/usage.apt Sun Jun  7 13:53:05 2009
@@ -3,7 +3,7 @@
  ------
  Lukas Theussl
  ------
- 2009-05-16
+ 2009-06-07
  ------
 
 ~~ Licensed to the Apache Software Foundation (ASF) under one
@@ -43,6 +43,9 @@
   where the first <<<pdf>>> refers to the plugin's alias, and the second
   <<<pdf>>> refers to a plugin goal.
 
+  <<Note>>: By default, the PDF plugin generates a PDF document which aggregates all your site documents.
+  If you want to generate each site document individually, you need to add <<<-Daggregate=false>>>.
+
 * Running the PDF plugin automatically during a build
 
   The PDF plugin can be put into a project's pom.xml so that it gets executed

Modified: maven/plugins/trunk/maven-pdf-plugin/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java?rev=782390&r1=782389&r2=782390&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java Sun Jun  7 13:53:05 2009
@@ -80,7 +80,7 @@
         PdfMojo mojo = (PdfMojo) lookupMojo( "pdf", testPom );
         assertNotNull( "pdf mojo not found!", mojo );
 
-        File pdfFile = new File( getBasedir(), "/target/test-output/pdf/index.pdf" );
+        File pdfFile = new File( getBasedir(), "/target/test-output/pdf/maven-pdf-plugin-doc.pdf" );
         if ( pdfFile.exists() )
         {
             pdfFile.delete();

Modified: maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/iText_pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/iText_pom.xml?rev=782390&r1=782389&r2=782390&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/iText_pom.xml (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/iText_pom.xml Sun Jun  7 13:53:05 2009
@@ -34,6 +34,7 @@
           <outputDirectory>${basedir}/target/test-output/pdf</outputDirectory>
           <workingDirectory>${basedir}/target/test-output/pdf</workingDirectory>
           <implementation>itext</implementation>
+          <aggregate>true</aggregate>
         </configuration>
       </plugin>
     </plugins>

Modified: maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom.xml?rev=782390&r1=782389&r2=782390&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom.xml (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom.xml Sun Jun  7 13:53:05 2009
@@ -34,6 +34,7 @@
           <outputDirectory>${basedir}/target/test-output/pdf</outputDirectory>
           <workingDirectory>${basedir}/target/test-output/pdf</workingDirectory>
           <implementation>fo</implementation>
+          <aggregate>true</aggregate>
         </configuration>
       </plugin>
     </plugins>

Modified: maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom_filtering.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom_filtering.xml?rev=782390&r1=782389&r2=782390&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom_filtering.xml (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/test/resources/unit/pdf/pom_filtering.xml Sun Jun  7 13:53:05 2009
@@ -61,6 +61,7 @@
           <outputDirectory>${basedir}/target/test-output/pdf</outputDirectory>
           <workingDirectory>${basedir}/target/test-output/pdf</workingDirectory>
           <implementation>fo</implementation>
+          <aggregate>true</aggregate>
         </configuration>
       </plugin>
     </plugins>