You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2018/06/03 21:22:51 UTC

[GitHub] hboutemy closed pull request #1: [MPDF-8] Create one PDF from a multi module project

hboutemy closed pull request #1: [MPDF-8] Create one PDF from a multi module project
URL: https://github.com/apache/maven-pdf-plugin/pull/1
 
 
   

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/pom.xml b/pom.xml
index 79ee291..e5ec8af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,7 +78,7 @@ under the License.
 
   <properties>
     <doxiaVersion>1.9-SNAPSHOT</doxiaVersion>
-    <doxiaSitetoolsVersion>1.7.5</doxiaSitetoolsVersion>
+    <doxiaSitetoolsVersion>1.8.1</doxiaSitetoolsVersion>
     <mavenVersion>2.2.1</mavenVersion>
   </properties>
 
@@ -240,6 +240,13 @@ under the License.
       </exclusions>
     </dependency>
 
+    <!-- JSON -->
+    <dependency>
+      <groupId>org.kopitubruk.util</groupId>
+      <artifactId>JSONUtil</artifactId>
+      <version>1.10.2-java6</version>
+    </dependency>
+
     <!-- test dependencies -->
     <dependency>
       <groupId>junit</groupId>
@@ -291,6 +298,27 @@ under the License.
         </executions>
       </plugin>
 <!-- END SNIPPET: configuration -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>enforce-bytecode-version</id>
+            <configuration>
+              <rules>
+                <enforceBytecodeVersion>
+                  <maxJdkVersion>${maven.compiler.target}</maxJdkVersion>
+                  <excludes><!-- DOXIA-554 Markdown parser requires Java 7 (use version 1.7 if you absolutely require Java 6) -->
+                    <exclude>org.apache.maven.doxia:doxia-module-markdown</exclude>
+                    <exclude>org.nibor.autolink:autolink</exclude>
+                  </excludes>
+                </enforceBytecodeVersion>
+              </rules>
+              <fail>true</fail>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/src/it/pdf-aggregate/invoker.properties b/src/it/pdf-aggregate/invoker.properties
new file mode 100644
index 0000000..fa2c540
--- /dev/null
+++ b/src/it/pdf-aggregate/invoker.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals = pdf:aggregate
+invoker.debug = false
\ No newline at end of file
diff --git a/src/it/pdf-aggregate/mod-a/pom.xml b/src/it/pdf-aggregate/mod-a/pom.xml
new file mode 100644
index 0000000..b70ddff
--- /dev/null
+++ b/src/it/pdf-aggregate/mod-a/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.its.pdf</groupId>
+    <artifactId>root</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>mod-a</artifactId>
+  <name>PDF:aggregate test: module A</name>
+  <description>
+    This is module A for multi-module PDF.
+  </description>
+</project>
diff --git a/src/it/pdf-aggregate/mod-a/src/site/apt/index.apt b/src/it/pdf-aggregate/mod-a/src/site/apt/index.apt
new file mode 100644
index 0000000..95721b4
--- /dev/null
+++ b/src/it/pdf-aggregate/mod-a/src/site/apt/index.apt
@@ -0,0 +1,31 @@
+ ------
+ Multi-module PDF: module A
+ ------
+ Lukas Theussl
+ ------
+ 2009-05-31
+ ------
+
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements.  See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership.  The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License.  You may obtain a copy of the License at
+~~
+~~   http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied.  See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+Overview
+
+  This is module A.
diff --git a/src/it/pdf-aggregate/mod-a/src/site/site.xml b/src/it/pdf-aggregate/mod-a/src/site/site.xml
new file mode 100644
index 0000000..3aac823
--- /dev/null
+++ b/src/it/pdf-aggregate/mod-a/src/site/site.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+    </menu>
+  </body>
+</project>
diff --git a/src/it/pdf-aggregate/mod-b/pom.xml b/src/it/pdf-aggregate/mod-b/pom.xml
new file mode 100644
index 0000000..336d785
--- /dev/null
+++ b/src/it/pdf-aggregate/mod-b/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.its.pdf</groupId>
+    <artifactId>root</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>mod-b</artifactId>
+  <name>PDF:aggregate test: module B</name>
+  <description>
+    This is module B for multi-module PDF.
+  </description>
+</project>
diff --git a/src/it/pdf-aggregate/mod-b/src/site/apt/index.apt b/src/it/pdf-aggregate/mod-b/src/site/apt/index.apt
new file mode 100644
index 0000000..c283fc1
--- /dev/null
+++ b/src/it/pdf-aggregate/mod-b/src/site/apt/index.apt
@@ -0,0 +1,31 @@
+ ------
+ Multi-module PDF: module B
+ ------
+ Lukas Theussl
+ ------
+ 2009-05-31
+ ------
+
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements.  See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership.  The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License.  You may obtain a copy of the License at
+~~
+~~   http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied.  See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+Overview
+
+  This is module B.
diff --git a/src/it/pdf-aggregate/mod-b/src/site/site.xml b/src/it/pdf-aggregate/mod-b/src/site/site.xml
new file mode 100644
index 0000000..3aac823
--- /dev/null
+++ b/src/it/pdf-aggregate/mod-b/src/site/site.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+    </menu>
+  </body>
+</project>
diff --git a/src/it/pdf-aggregate/pom.xml b/src/it/pdf-aggregate/pom.xml
new file mode 100644
index 0000000..40b4898
--- /dev/null
+++ b/src/it/pdf-aggregate/pom.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.pdf</groupId>
+  <artifactId>root</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>PDF:aggregate test: multi-module root</name>
+  <description>
+    Tests a PDF generation for a multi-module, running pdf:aggregate (that forks pdf:pdf for each module before aggregating).
+  </description>
+
+  <organization>
+    <name>The Apache Software Foundation</name>
+    <url>http://www.apache.org/</url>
+  </organization>
+
+  <contributors>
+    <contributor>
+      <name>Anthony Beurivé</name>
+    </contributor>
+  </contributors>
+
+  <issueManagement>
+    <system>JIRA</system>
+    <url>https://issues.apache.org/jira/browse/MPDF</url>
+  </issueManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <modules>
+    <module>mod-a</module>
+    <module>mod-b</module>
+  </modules>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.4.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pdf-plugin</artifactId>
+        <version>@project.version@</version>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <reporting>
+    <plugins>
+      <plugin>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <version>2.9</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>cim</report>
+              <report>dependencies</report><!-- generated xdoc is not valid XML: missing <table> -->
+              <report>dependency-convergence</report><!-- generated xdoc is not valid XML: missing <table> -->
+              <report>dependency-info</report>
+              <report>dependency-management</report>
+              <report>issue-tracking</report>
+              <report>license</report>
+              <report>mailing-list</report>
+              <report>plugins</report>
+              <report>summary</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>  
+  
+</project>
diff --git a/src/it/pdf-aggregate/src/site/apt/index.apt b/src/it/pdf-aggregate/src/site/apt/index.apt
new file mode 100644
index 0000000..edf3806
--- /dev/null
+++ b/src/it/pdf-aggregate/src/site/apt/index.apt
@@ -0,0 +1,35 @@
+ ------
+ Multi-module PDF
+ ------
+ Lukas Theussl
+ ------
+ 2009-05-31
+ ------
+
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements.  See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership.  The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License.  You may obtain a copy of the License at
+~~
+~~   http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied.  See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+Overview
+
+  This test shows how multi-module PDF generation works, running:
+
++--------+
+mvn pdf:stage
++--------+
diff --git a/src/it/pdf-aggregate/src/site/site.xml b/src/it/pdf-aggregate/src/site/site.xml
new file mode 100644
index 0000000..3aac823
--- /dev/null
+++ b/src/it/pdf-aggregate/src/site/site.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project>
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+    </menu>
+  </body>
+</project>
diff --git a/src/it/pdf-aggregate/verify.groovy b/src/it/pdf-aggregate/verify.groovy
new file mode 100644
index 0000000..bc03a20
--- /dev/null
+++ b/src/it/pdf-aggregate/verify.groovy
@@ -0,0 +1,25 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+pdfFile = new File( basedir, "target/pdf-aggregate/root.pdf" )
+
+assert pdfFile.text.contains( "PDF:aggregate test: multi-module root" )
+assert pdfFile.text.contains( "PDF:aggregate test: module A" )
+assert pdfFile.text.contains( "PDF:aggregate test: module B" )
diff --git a/src/main/java/org/apache/maven/plugins/pdf/AbstractPdfMojo.java b/src/main/java/org/apache/maven/plugins/pdf/AbstractPdfMojo.java
new file mode 100644
index 0000000..152ed69
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/pdf/AbstractPdfMojo.java
@@ -0,0 +1,68 @@
+package org.apache.maven.plugins.pdf;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.AbstractMojo;
+
+/**
+ * Common code to create pdf, either module pdf or reactor aggregate.
+ * 
+ * @since 1.5
+ */
+public abstract class AbstractPdfMojo
+    extends AbstractMojo
+{
+    protected abstract File getOutputDirectory();
+    protected abstract File getWorkingDirectory();
+    protected abstract boolean isIncludeReports();
+
+    /**
+     * The temp Site dir to have all site and generated-site files.
+     *
+     * @since 1.1
+     */
+    private File siteDirectoryTmp;
+
+    protected abstract void prepareTempSiteDirectory( final File tmpSiteDir )
+        throws IOException;
+
+    /**
+     * @return the default tmpSiteDirectory.
+     * @throws IOException if any
+     * @since 1.1
+     */
+    protected File getSiteDirectoryTmp()
+        throws IOException
+    {
+        if ( this.siteDirectoryTmp == null )
+        {
+            final File tmpSiteDir = new File( getWorkingDirectory(), "site.tmp" );
+            prepareTempSiteDirectory( tmpSiteDir );
+
+            this.siteDirectoryTmp = tmpSiteDir;
+        }
+
+        return this.siteDirectoryTmp;
+    }
+
+}
diff --git a/src/main/java/org/apache/maven/plugins/pdf/DateBean.java b/src/main/java/org/apache/maven/plugins/pdf/DateBean.java
index b0b7db2..15b6d5d 100644
--- a/src/main/java/org/apache/maven/plugins/pdf/DateBean.java
+++ b/src/main/java/org/apache/maven/plugins/pdf/DateBean.java
@@ -25,7 +25,6 @@
 import java.util.Locale;
 import java.util.TimeZone;
 
-
 /**
  * Simple bean to allow date interpolation in the document descriptor, i.e.
  * <pre>
@@ -33,7 +32,6 @@
  * ${date}  = 2009-05-17
  * </pre>
  * @author ltheussl
- * @version $Id$
  */
 public class DateBean
 {
@@ -94,7 +92,6 @@ public void setDate( final Date date )
         this.date = date;
     }
 
-
     /**
      * @return the year in format "yyyy".
      */
diff --git a/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java b/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java
index bb778ed..e8c56c8 100644
--- a/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java
+++ b/src/main/java/org/apache/maven/plugins/pdf/DocumentDescriptorReader.java
@@ -48,7 +48,6 @@
  * Read and filter a DocumentModel from a document descriptor file.
  *
  * @author ltheussl
- * @version $Id$
  */
 public class DocumentDescriptorReader
 {
diff --git a/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java b/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java
index 2ef7fbc..d910fee 100644
--- a/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java
+++ b/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java
@@ -43,7 +43,6 @@
  * Construct a DocumentModel from a MavenProject and related information.
  *
  * @author ltheussl
- * @version $Id$
  */
 public class DocumentModelBuilder
 {
diff --git a/src/main/java/org/apache/maven/plugins/pdf/PdfAggregateMojo.java b/src/main/java/org/apache/maven/plugins/pdf/PdfAggregateMojo.java
new file mode 100644
index 0000000..e45342c
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/pdf/PdfAggregateMojo.java
@@ -0,0 +1,257 @@
+package org.apache.maven.plugins.pdf;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.document.DocumentModel;
+import org.apache.maven.doxia.document.DocumentTOC;
+import org.apache.maven.doxia.document.DocumentTOCItem;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Deque;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Forks {@code pdf} goal then aggregates PDF content from all modules in the reactor.
+ *
+ * @author anthony-beurive
+ * @since 1.5
+ */
+@Mojo( name = "aggregate", aggregator = true, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true )
+@Execute( goal = "pdf" )
+public class PdfAggregateMojo
+    extends PdfMojo // TODO should extend AbstractPdfMojo, but requires extensive refactoring
+{
+    /**
+     * The reactor projects.
+     */
+    @Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true )
+    private List<MavenProject> reactorProjects;
+
+    /**
+     * Output directory where aggregated PDF files should be created.
+     */
+    @Parameter( defaultValue = "${project.build.directory}/pdf-aggregate", required = true )
+    private File aggregatedOutputDirectory;
+
+    /**
+     * Working directory for aggregated working files like temp files/resources.
+     */
+    @Parameter( defaultValue = "${project.build.directory}/pdf-aggregate", required = true )
+    private File aggregatedWorkingDirectory;
+
+    protected File getOutputDirectory()
+    {
+        return aggregatedOutputDirectory;
+    }
+
+    protected File getWorkingDirectory()
+    {
+        return aggregatedWorkingDirectory;
+    }
+
+    protected boolean isIncludeReports()
+    {
+        return false; // reports were generate (or not) during pdf:pdf: here, we only aggregate
+    }
+
+    protected void prepareTempSiteDirectory( final File tmpSiteDir )
+        throws IOException
+    {
+        tmpSiteDir.mkdirs();
+    }
+
+    @Override
+    protected void appendGeneratedReports( DocumentModel model, Locale locale )
+    {
+        super.appendGeneratedReports( model, locale );
+
+        getLog().info( "Appending staged reports." );
+
+        DocumentTOC toc = model.getToc();
+
+        File dstSiteTmp = null;
+        try
+        {
+            dstSiteTmp = getSiteDirectoryTmp();
+        }
+        catch ( IOException ioe )
+        {
+            getLog().error( "unexpected IOException while getting aggregator root tmp site dir", ioe );
+        }
+        if ( !dstSiteTmp.exists() )
+        {
+            getLog().error( "Top-level project does not have src.tmp directory" );
+            return;
+        }
+
+        for ( MavenProject reactorProject : reactorProjects )
+        {
+            getLog().info( "Appending " + reactorProject.getArtifactId() + " reports." );
+
+            copySiteDirectoryTmp( reactorProject, dstSiteTmp );
+
+            addTOCItems( toc, reactorProject );
+        }
+    }
+
+    private void copySiteDirectoryTmp( MavenProject project, File dstSiteTmp )
+    {
+        Reporting reporting = project.getReporting();
+        if ( reporting == null )
+        {
+            getLog().info( "Skipping reactor project " + project + ": no reporting" );
+            return;
+        }
+
+        File srcSiteTmp = getModuleSiteDirectoryTmp( project );
+        if ( !srcSiteTmp.exists() )
+        {
+            getLog().info( "Skipping reactor project " + project + ": no site.tmp directory" );
+            return;
+        }
+
+        String stagedId = getStagedId( project );
+
+        try
+        {
+            String defaultExcludes = FileUtils.getDefaultExcludesAsString();
+            List<String> srcDirNames = FileUtils.getDirectoryNames( srcSiteTmp, "*", defaultExcludes, false );
+            for ( String srcDirName : srcDirNames )
+            {
+                File srcDir = new File( srcSiteTmp, srcDirName );
+                File dstDir = new File( new File( dstSiteTmp, srcDirName ), stagedId );
+                if ( !dstDir.exists() && !dstDir.mkdirs() )
+                {
+                    getLog().error( "Could not create directory: " + dstDir );
+                    return;
+                }
+
+                FileUtils.copyDirectoryStructure( srcDir, dstDir );
+            }
+        }
+        catch ( IOException e )
+        {
+            getLog().error( "Error while copying sub-project " + project.getArtifactId()
+                                    + " site.tmp: " + e.getMessage(), e );
+        }
+    }
+
+    private void addTOCItems( DocumentTOC topLevelToc, MavenProject project )
+    {
+        String stagedId = getStagedId( project );
+
+        Map<String, Object> toc = loadToc( project );
+
+        List<Map<String, Object>> items = (ArrayList) toc.get( "items" );
+
+        DocumentTOCItem tocItem = new DocumentTOCItem();
+        tocItem.setName( project.getName() );
+        tocItem.setRef( stagedId );
+
+        if ( items.size() == 1 && "project-info".equals( items.get( 0 ).get( "ref" ) ) )
+        {
+            // Special case where a sub-project only contains generated reports.
+            items = (List) items.get( 0 ).get( "items" );
+        }
+
+        for ( Map<String, Object> item : items )
+        {
+            addTOCItems( tocItem, item, stagedId );
+        }
+
+        topLevelToc.addItem( tocItem );
+    }
+
+    private Map<String, Object> loadToc( MavenProject project )
+    {
+        try
+        {
+            return TocFileHelper.loadToc( getModuleWorkingDirectory( project ) );
+        }
+        catch ( IOException e )
+        {
+            getLog().error( "Error while reading table of contents of module " + project.getArtifactId(), e );
+            return Collections.<String, Object>emptyMap();
+        }
+    }
+
+    private void addTOCItems( DocumentTOCItem parent, Map<String, Object> item, String stagedId )
+    {
+        DocumentTOCItem tocItem = new DocumentTOCItem();
+        tocItem.setName( (String) item.get( "name" ) );
+        tocItem.setRef( stagedId + "/" + item.get( "ref" ) );
+
+        List<Map<String, Object>> items = (ArrayList) item.get( "items" );
+
+        for ( Map<String, Object> it : items )
+        {
+            addTOCItems( tocItem, it, stagedId );
+        }
+
+        parent.addItem( tocItem );
+    }
+
+    private String getStagedId( MavenProject p )
+    {
+        Deque<String> projectPath = new ArrayDeque<String>();
+        projectPath.addFirst( p.getArtifactId() );
+        while ( p.getParent() != null )
+        {
+            p = p.getParent();
+            projectPath.addFirst( p.getArtifactId() );
+        }
+
+        StringBuilder stagedId = new StringBuilder();
+        Iterator<String> artifactIds = projectPath.iterator();
+        while ( artifactIds.hasNext() )
+        {
+            stagedId.append( artifactIds.next() );
+            if ( artifactIds.hasNext() )
+            {
+                stagedId.append( '/' );
+            }
+        }
+        return stagedId.toString();
+    }
+
+    private File getModuleWorkingDirectory( MavenProject project )
+    {
+        return new File( project.getBuild().getDirectory(), "pdf" );
+    }
+
+    private File getModuleSiteDirectoryTmp( MavenProject project )
+    {
+        return new File( getModuleWorkingDirectory( project ), "site.tmp" );
+    }
+}
diff --git a/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java b/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
index ac41cc1..63fab30 100644
--- a/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
+++ b/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
@@ -48,6 +48,7 @@
 import org.apache.maven.doxia.docrenderer.pdf.PdfRenderer;
 import org.apache.maven.doxia.document.DocumentMeta;
 import org.apache.maven.doxia.document.DocumentModel;
+import org.apache.maven.doxia.document.DocumentTOC;
 import org.apache.maven.doxia.document.DocumentTOCItem;
 import org.apache.maven.doxia.document.io.xpp3.DocumentXpp3Writer;
 import org.apache.maven.doxia.index.IndexEntry;
@@ -68,13 +69,13 @@
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.model.Reporting;
-import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.PluginManager;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.reporting.AbstractMavenReportRenderer;
@@ -103,11 +104,10 @@
  * Generates a PDF document for a project documentation usually published as web site (with maven-site-plugin).
  *
  * @author ltheussl
- * @version $Id$
  */
-@Mojo( name = "pdf", threadSafe = true )
+@Mojo( name = "pdf", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true )
 public class PdfMojo
-    extends AbstractMojo implements Contextualizable
+    extends AbstractPdfMojo implements Contextualizable
 {
 
     /**
@@ -188,7 +188,7 @@
      * The Maven Project Object.
      */
     @Parameter( defaultValue = "${project}", readonly = true, required = true )
-    private MavenProject project;
+    protected MavenProject project;
 
     /**
      * The Maven Settings.
@@ -301,7 +301,7 @@
      */
     @Parameter( property = "validate", defaultValue = "false" )
     private boolean validate;
-    
+
     /**
      * Reports (Maven 2).
      *
@@ -309,7 +309,7 @@
      */
     @Parameter( defaultValue = "${reports}", required = true, readonly = true )
     private MavenReport[] reports;
-    
+
     /**
      * Reports (Maven 3).
      *
@@ -343,13 +343,6 @@
      */
     private DecorationModel defaultDecorationModel;
 
-    /**
-     * The temp Site dir to have all site and generated-site files.
-     *
-     * @since 1.1
-     */
-    private File siteDirectoryTmp;
-
     /**
      * The temp Generated Site dir to have generated reports by this plugin.
      *
@@ -363,7 +356,7 @@
      * @since 1.1
      */
     private Map<Locale, List<MavenReport>> generatedMavenReports;
-    
+
     /**
      * @since 1.3
      */
@@ -399,7 +392,7 @@ public void execute()
             throw new MojoExecutionException( "Error copying generated PDF: " + e.getMessage(), e );
         }
     }
-    
+
     /** {@inheritDoc} */
     public void contextualize( Context context )
         throws ContextException
@@ -407,6 +400,21 @@ public void contextualize( Context context )
         container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
     }
 
+    protected File getOutputDirectory()
+    {
+        return outputDirectory;
+    }
+
+    protected File getWorkingDirectory()
+    {
+        return workingDirectory;
+    }
+
+    protected boolean isIncludeReports()
+    {
+        return includeReports;
+    }
+
     // ----------------------------------------------------------------------
     // Private methods
     // ----------------------------------------------------------------------
@@ -452,7 +460,8 @@ else if ( "itext".equalsIgnoreCase( implementation ) )
     private void copyGeneratedPdf()
         throws MojoExecutionException, IOException
     {
-        boolean requireCopy = !outputDirectory.getCanonicalPath().equals( workingDirectory.getCanonicalPath() );
+        boolean requireCopy =
+            !getOutputDirectory().getCanonicalPath().equals( getWorkingDirectory().getCanonicalPath() );
 
         String outputName = getDocumentModel( getDefaultLocale() ).getOutputName().trim();
         if ( !outputName.endsWith( ".pdf" ) )
@@ -462,7 +471,7 @@ private void copyGeneratedPdf()
 
         for ( final Locale locale : getAvailableLocales() )
         {
-            File generatedPdfSource = new File( getLocaleDirectory( workingDirectory, locale ), outputName );
+            File generatedPdfSource = new File( getLocaleDirectory( getWorkingDirectory(), locale ), outputName );
 
             if ( !generatedPdfSource.exists() )
             {
@@ -470,7 +479,7 @@ private void copyGeneratedPdf()
                 continue;
             }
 
-            File generatedPdfDest = new File( getLocaleDirectory( outputDirectory, locale ), outputName );
+            File generatedPdfDest = new File( getLocaleDirectory( getOutputDirectory(), locale ), outputName );
 
             if ( requireCopy )
             {
@@ -496,7 +505,7 @@ private void generatePdf()
 
         for ( final Locale locale : getAvailableLocales() )
         {
-            final File workingDir = getLocaleDirectory( workingDirectory, locale );
+            final File workingDir = getLocaleDirectory( getWorkingDirectory(), locale );
 
             File siteDirectoryFile = getLocaleDirectory( getSiteDirectoryTmp(), locale );
 
@@ -519,7 +528,7 @@ private void generatePdf()
             {
                 context.put( (String) entry.getKey(), entry.getValue() );
             }
-            
+
             final DocumentModel model = aggregate ? getDocumentModel( locale ) : null;
 
             try
@@ -534,25 +543,6 @@ private void generatePdf()
         }
     }
 
-    /**
-     * @return the default tmpSiteDirectory.
-     * @throws IOException if any
-     * @since 1.1
-     */
-    private File getSiteDirectoryTmp()
-        throws IOException
-    {
-        if ( this.siteDirectoryTmp == null )
-        {
-            final File tmpSiteDir = new File( workingDirectory, "site.tmp" );
-            prepareTempSiteDirectory( tmpSiteDir );
-
-            this.siteDirectoryTmp = tmpSiteDir;
-        }
-
-        return this.siteDirectoryTmp;
-    }
-
     /**
      * @return the default tmpGeneratedSiteDirectory when report will be created.
      * @since 1.1
@@ -561,7 +551,7 @@ private File getGeneratedSiteDirectoryTmp()
     {
         if ( this.generatedSiteDirectoryTmp == null )
         {
-            this.generatedSiteDirectoryTmp = new File( workingDirectory, "generated-site.tmp" );
+            this.generatedSiteDirectoryTmp = new File( getWorkingDirectory(), "generated-site.tmp" );
         }
 
         return this.generatedSiteDirectoryTmp;
@@ -577,7 +567,7 @@ private File getGeneratedSiteDirectoryTmp()
      * @throws IOException if any
      * @since 1.1
      */
-    private void prepareTempSiteDirectory( final File tmpSiteDir )
+    protected void prepareTempSiteDirectory( final File tmpSiteDir )
         throws IOException
     {
         // safety
@@ -695,6 +685,8 @@ private DocumentModel getDocumentModel( Locale locale )
 
             appendGeneratedReports( doc, locale );
 
+            saveTOC( doc.getToc(), locale );
+
             return doc;
         }
 
@@ -707,6 +699,8 @@ private DocumentModel getDocumentModel( Locale locale )
 
         appendGeneratedReports( model, locale );
 
+        saveTOC( model.getToc(), locale );
+
         debugLogGeneratedModel( model );
 
         return model;
@@ -901,7 +895,7 @@ private void copyResources( Locale locale )
                                                    project.getName(), locale );
             context.addSiteDirectory( new File( siteDirectory, locale.getLanguage() ) );
 
-            siteRenderer.copyResources( context, workingDirectory );
+            siteRenderer.copyResources( context, getWorkingDirectory() );
         }
         catch ( IOException e )
         {
@@ -975,7 +969,7 @@ private void debugLogGeneratedModel( final DocumentModel docModel )
     private void generateMavenReports( Locale locale )
         throws MojoExecutionException, IOException
     {
-        if ( !includeReports )
+        if ( !isIncludeReports() )
         {
             getLog().info( "Skipped report generation." );
             return;
@@ -1062,11 +1056,11 @@ private void generateMavenReport( MavenReportExecution reportExecution, Locale l
                     FileUtils.getFileNames( new File( siteDirectory, locale.getLanguage() ), "*/"
                         + report.getOutputName() + ".*", excludes, false );
             }
-    
+
             if ( files.size() != 0 )
             {
                 String displayLanguage = locale.getDisplayLanguage( Locale.ENGLISH );
-    
+
                 if ( getLog().isInfoEnabled() )
                 {
                     getLog().info(
@@ -1074,7 +1068,7 @@ private void generateMavenReport( MavenReportExecution reportExecution, Locale l
                                        + report.getOutputName() + "\" already exists for the " + displayLanguage
                                        + " version." );
                 }
-    
+
                 return;
             }
         }
@@ -1084,6 +1078,9 @@ private void generateMavenReport( MavenReportExecution reportExecution, Locale l
             getLog().info( "Generating \"" + localReportName + "\" report." );
         }
 
+        // The report will eventually generate output by itself, so we set its output directory anyway.
+        report.setReportOutputDirectory( outDir );
+
         StringWriter sw = new StringWriter();
 
         PdfXdocSink sink = null;
@@ -1138,9 +1135,9 @@ private void renderReportToSink( MavenReportExecution reportExec, Locale locale,
             {
                 Thread.currentThread().setContextClassLoader( reportExec.getClassLoader() );
             }
-    
+
             MavenReport report = reportExec.getMavenReport();
-    
+
             /*if ( report instanceof MavenMultiPageReport )
             {
                 // extended multi-page API
@@ -1188,10 +1185,10 @@ else if ( generateMultiPage( locale, multiPageSinkFactory, mainSink ) )
     /**
      * Append generated reports to the toc only if <code>generateReports</code> is enabled, for instance:
      * <pre>
-     * &lt;item name="Project Reports" ref="/project-info"&gt;
-     * &nbsp;&nbsp;&lt;item name="Project License" ref="/license" /&gt;
-     * &nbsp;&nbsp;&lt;item name="Project Team" ref="/team-list" /&gt;
-     * &nbsp;&nbsp;&lt;item name="Continuous Integration" ref="/integration" /&gt;
+     * &lt;item name="Project Reports" ref="project-info"&gt;
+     * &nbsp;&nbsp;&lt;item name="Project License" ref="license" /&gt;
+     * &nbsp;&nbsp;&lt;item name="Project Team" ref="team-list" /&gt;
+     * &nbsp;&nbsp;&lt;item name="Continuous Integration" ref="integration" /&gt;
      * &nbsp;&nbsp;...
      * &lt;/item&gt;
      * </pre>
@@ -1201,9 +1198,9 @@ else if ( generateMultiPage( locale, multiPageSinkFactory, mainSink ) )
      * @see #generateMavenReports(Locale)
      * @since 1.1
      */
-    private void appendGeneratedReports( DocumentModel model, Locale locale )
+    protected void appendGeneratedReports( DocumentModel model, Locale locale )
     {
-        if ( !includeReports )
+        if ( !isIncludeReports() )
         {
             return;
         }
@@ -1214,7 +1211,7 @@ private void appendGeneratedReports( DocumentModel model, Locale locale )
 
         final DocumentTOCItem documentTOCItem = new DocumentTOCItem();
         documentTOCItem.setName( i18n.getString( "pdf-plugin", locale, "toc.project-info.item" ) );
-        documentTOCItem.setRef( "/project-info" ); // see #generateMavenReports(Locale)
+        documentTOCItem.setRef( "project-info" ); // see #generateMavenReports(Locale)
 
         List<String> addedRef = new ArrayList<String>( 4 );
 
@@ -1225,7 +1222,7 @@ private void appendGeneratedReports( DocumentModel model, Locale locale )
         {
             final DocumentTOCItem reportItem = new DocumentTOCItem();
             reportItem.setName( report.getName( locale ) );
-            reportItem.setRef( "/" + report.getOutputName() );
+            reportItem.setRef( report.getOutputName() );
 
             items.add( reportItem );
 
@@ -1265,7 +1262,7 @@ private void appendGeneratedReports( DocumentModel model, Locale locale )
                             {
                                 final DocumentTOCItem reportItem = new DocumentTOCItem();
                                 reportItem.setName( title );
-                                reportItem.setRef( "/" + ref );
+                                reportItem.setRef( ref );
 
                                 items.add( reportItem );
                             }
@@ -1285,6 +1282,18 @@ private void appendGeneratedReports( DocumentModel model, Locale locale )
         model.getToc().addItem( documentTOCItem );
     }
 
+    private void saveTOC( DocumentTOC toc, Locale locale )
+    {
+        try
+        {
+            TocFileHelper.saveTOC( getWorkingDirectory(), toc, locale );
+        }
+        catch ( IOException e )
+        {
+            getLog().error( "Error while writing table of contents", e );
+        }
+    }
+
     /**
      * Parse a generated Doxia file and returns its title.
      *
@@ -1346,7 +1355,7 @@ private boolean isValidGeneratedReportXdoc( String fullGoal, File generatedRepor
         {
             reader = ReaderFactory.newXmlReader( generatedReport );
 
-            doxia.parse( reader, generatedReport.getParentFile().getName(), sinkAdapter );
+            doxia.parse( reader, "xdoc", sinkAdapter );
 
             reader.close();
             reader = null;
diff --git a/src/main/java/org/apache/maven/plugins/pdf/TocFileHelper.java b/src/main/java/org/apache/maven/plugins/pdf/TocFileHelper.java
new file mode 100644
index 0000000..c42b29f
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/pdf/TocFileHelper.java
@@ -0,0 +1,91 @@
+package org.apache.maven.plugins.pdf;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.maven.doxia.document.DocumentTOC;
+import org.apache.maven.doxia.document.DocumentTOCItem;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.WriterFactory;
+import org.kopitubruk.util.json.IndentPadding;
+import org.kopitubruk.util.json.JSONConfig;
+import org.kopitubruk.util.json.JSONParser;
+import org.kopitubruk.util.json.JSONUtil;
+
+/**
+ * Helper to save then reload TOC content (to a json file), to be able to aggregate TOCs.
+ * 
+ * @author anthony-beurive
+ * @since 1.5
+ */
+class TocFileHelper
+{
+    private static final String FILENAME = "toc.json";
+
+    static void saveTOC( File workingDirectory, DocumentTOC toc, Locale locale )
+        throws IOException
+    {
+        // FIXME: manage locales.
+        JSONConfig jsonConfig = new JSONConfig();
+        jsonConfig.setIndentPadding( new IndentPadding( "  ", "\n" ) );
+        jsonConfig.addReflectClass( DocumentTOC.class );
+        jsonConfig.addReflectClass( DocumentTOCItem.class );
+
+        Writer writer = null;
+        try
+        {
+            writer = WriterFactory.newWriter( getTocFile( workingDirectory ), "UTF-8" );
+            JSONUtil.toJSON( toc, jsonConfig, writer );
+            writer.close();
+            writer = null;
+        }
+        finally
+        {
+            IOUtil.close( writer );
+        }
+    }
+
+    static Map<String, Object> loadToc( File workingDirectory )
+        throws IOException
+    {
+        Reader reader = null;
+        try
+        {
+            reader = ReaderFactory.newReader( getTocFile( workingDirectory ), "UTF-8" );
+            return (Map) JSONParser.parseJSON( reader );
+        }
+        finally
+        {
+            IOUtil.close( reader );
+        }
+    }
+
+    private static File getTocFile( File workingDirectory )
+    {
+        return new File( workingDirectory, FILENAME );
+    }
+}
diff --git a/src/main/resources/pdf-plugin_fr.properties b/src/main/resources/pdf-plugin_fr.properties
index ea904c2..0191455 100644
--- a/src/main/resources/pdf-plugin_fr.properties
+++ b/src/main/resources/pdf-plugin_fr.properties
@@ -22,6 +22,6 @@ toc.project-info.item                  = Rapports Projet
 report.project-info.column.description = Description
 report.project-info.column.document    = Document
 report.project-info.sectionTitle       = Vue d'ensemble
-report.project-info.description1       = Ce document fournit une vue d'ensemble des divers documents et liens qui font partis des informations g\u00e9n\u00e9rales du projet. Tous ces contenus sont g\u00e9n\u00e9r\u00e9s automatiquement par
+report.project-info.description1       = Ce document fournit une vue d'ensemble des divers documents et liens qui font partie des informations g\u00e9n\u00e9rales du projet. Tous ces contenus sont g\u00e9n\u00e9r\u00e9s automatiquement par
 report.project-info.description2       = le projet lui-m\u00eame.
 report.project-info.title              = Information g\u00e9n\u00e9rale du projet
diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm
index 09d4f42..cf13dc9 100644
--- a/src/site/xdoc/download.xml.vm
+++ b/src/site/xdoc/download.xml.vm
@@ -108,7 +108,7 @@ under the License.
           <tr>
             <td>${project.name} ${project.version} (Source zip)</td>
             <td><a href="[preferred]maven/plugins/${project.artifactId}-${project.version}-source-release.zip">maven/plugins/${project.artifactId}-${project.version}-source-release.zip</a></td>
-            <td><a href="http://www.apache.org/dist/maven/plugins/${project.artifactId}-${project.version}-source-release.zip.md5">maven/plugins/${project.artifactId}-${project.version}-source-release.zip.md5</a></td>
+            <td><a href="http://www.apache.org/dist/maven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha1">maven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha1</a></td>
             <td><a href="http://www.apache.org/dist/maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc">maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc</a></td>
           </tr>
         </tbody>
diff --git a/src/test/java/org/apache/maven/plugins/pdf/DocumentDescriptorReaderTest.java b/src/test/java/org/apache/maven/plugins/pdf/DocumentDescriptorReaderTest.java
index 9d6efbf..d402633 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/DocumentDescriptorReaderTest.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/DocumentDescriptorReaderTest.java
@@ -19,7 +19,6 @@
  * under the License.
  */
 
-
 import java.io.File;
 
 import org.apache.maven.doxia.document.DocumentModel;
@@ -30,7 +29,6 @@
 /**
  *
  * @author ltheussl
- * @version $Id$
  */
 public class DocumentDescriptorReaderTest
         extends PlexusTestCase
diff --git a/src/test/java/org/apache/maven/plugins/pdf/DocumentModelBuilderTest.java b/src/test/java/org/apache/maven/plugins/pdf/DocumentModelBuilderTest.java
index 2d683dc..e2829e9 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/DocumentModelBuilderTest.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/DocumentModelBuilderTest.java
@@ -40,7 +40,6 @@
 /**
  *
  * @author ltheussl
- * @version $Id$
  */
 public class DocumentModelBuilderTest
         extends PlexusTestCase
diff --git a/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java b/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java
index 310c033..28ff7ec 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java
@@ -30,7 +30,6 @@
 
 /**
  * @author ltheussl
- * @version $Id$
  */
 public class PdfMojoTest
     extends AbstractMojoTestCase
diff --git a/src/test/java/org/apache/maven/plugins/pdf/stubs/DefaultMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pdf/stubs/DefaultMavenProjectStub.java
index 8cae728..48f3e70 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/stubs/DefaultMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/stubs/DefaultMavenProjectStub.java
@@ -35,7 +35,6 @@
 
 /**
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @version $Id$
  */
 public class DefaultMavenProjectStub
     extends MavenProjectStub
diff --git a/src/test/java/org/apache/maven/plugins/pdf/stubs/FilteringMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pdf/stubs/FilteringMavenProjectStub.java
index 89e6321..68c2b3b 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/stubs/FilteringMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/stubs/FilteringMavenProjectStub.java
@@ -36,7 +36,6 @@
 
 /**
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @version $Id$
  */
 public class FilteringMavenProjectStub
     extends MavenProjectStub
diff --git a/src/test/java/org/apache/maven/plugins/pdf/stubs/ITextMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pdf/stubs/ITextMavenProjectStub.java
index 23e169a..7d81d5a 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/stubs/ITextMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/stubs/ITextMavenProjectStub.java
@@ -35,7 +35,6 @@
 
 /**
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @version $Id$
  */
 public class ITextMavenProjectStub
     extends MavenProjectStub
diff --git a/src/test/java/org/apache/maven/plugins/pdf/stubs/ModelBuilderMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pdf/stubs/ModelBuilderMavenProjectStub.java
index 34cb5ba..2369900 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/stubs/ModelBuilderMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/stubs/ModelBuilderMavenProjectStub.java
@@ -32,7 +32,6 @@
 
 /**
  * @author ltheussl
- * @version $Id$
  */
 public class ModelBuilderMavenProjectStub
     extends MavenProjectStub


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services