Maven PDF Plugin
  1. Maven PDF Plugin
  2. MPDF-8

Create one PDF from a multi module project

    Details

    • Type: New Feature New Feature
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Activity

      Hide
      Steven Swor added a comment -

      Until this issue is resolved, here is a workaround. Essentially, it flattens the site hierarchy, before running the PDF plugin, by copying the sources from the parent and all child modules into a single folder.

      In the parent's pom.xml:

      <properties>
        <site.aggregate.dir>${project.build.directory}/pdf-aggregate</site.aggregate.dir>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>aggregate-pdf-sources</id>
                <phase>pre-site</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${site.aggregate.dir}</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/site/</directory>
                    </resource>
      
                    <!-- repeat for each module -->
                    <resource>
                      <directory>module1/src/site</directory>
                      <excludes>
                        <exclude>site.xml</exclude>
                      </excludes>
                    </resource>
      
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pdf-plugin</artifactId>
            <version>1.2</version>
            <configuration>
              <siteDirectory>${site.aggregate.dir}</siteDirectory>
            </configuration>
          </plugin>
        </plugins>
      </build>
      

      This works well when the PDF plugin is configured to run as part of the site phase. If not, simply run mvn pre-site pdf:pdf.

      Show
      Steven Swor added a comment - Until this issue is resolved, here is a workaround. Essentially, it flattens the site hierarchy, before running the PDF plugin, by copying the sources from the parent and all child modules into a single folder. In the parent's pom.xml: <properties> <site.aggregate.dir> ${project.build.directory}/pdf-aggregate </site.aggregate.dir> </properties> <build> <plugins> <plugin> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-resources-plugin </artifactId> <executions> <execution> <id> aggregate-pdf-sources </id> <phase> pre-site </phase> <goals> <goal> copy-resources </goal> </goals> <configuration> <outputDirectory> ${site.aggregate.dir} </outputDirectory> <resources> <resource> <directory> src/site/ </directory> </resource> <!-- repeat for each module --> <resource> <directory> module1/src/site </directory> <excludes> <exclude> site.xml </exclude> </excludes> </resource> </resources> </configuration> </execution> </executions> </plugin> <plugin> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-pdf-plugin </artifactId> <version> 1.2 </version> <configuration> <siteDirectory> ${site.aggregate.dir} </siteDirectory> </configuration> </plugin> </plugins> </build> This works well when the PDF plugin is configured to run as part of the site phase. If not, simply run mvn pre-site pdf:pdf .

        People

        • Assignee:
          Unassigned
          Reporter:
          Lukas Theussl
        • Votes:
          4 Vote for this issue
          Watchers:
          4 Start watching this issue

          Dates

          • Created:
            Updated: