jacoco和pit生成PDF文件

Generate PDF file from jacoco and pit

有什么建议吗?

<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>

Jacoco 的默认输出文件夹值为 ${project.reporting.outputDirectory}/jacocomaven-pdf-pluginsite 文件夹的默认值为 ${basedir}/src/site

因此,您需要配置 maven-pdf-plugin,以查看 Jacoco 报告包含的位置。

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

...