javamavenjacocojacoco-maven-pluginmaven-pdf-plugin

Generate PDF file from jacoco and pit


Any suggestions?

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-pdf-plugin</artifactId>
    <executions>
        <execution>
            <id>pdf</id>
            <phase>site</phase>
            <goals>
                <goal>pdf</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.reporting.outputDirectory}</outputDirectory>
                <includeReports>true</includeReports>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/xalan/xalan -->
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>2.7.1</version>
        </dependency>

    </dependencies>
</plugin>

Solution

  • Default output folder value for Jacoco is ${project.reporting.outputDirectory}/jacoco, default value for site folder in maven-pdf-plugin is ${basedir}/src/site.

    So, you need to configure maven-pdf-plugin, to see, where Jacoco reports contain.

    ...
    <configuration>
        <outputDirectory>${project.reporting.outputDirectory}</outputDirectory>
        <includeReports>true</includeReports>
        <siteDirectory>${project.reporting.outputDirectory}/jacoco</siteDirectory> <!-- specify your jacoco reports folder-->
    </configuration>
    

    ...