在JaCoCo中排除com.ibm包 | AI生成和翻译

Home 2025.09

若要在 WebSphere Liberty Profile 环境中从 JaCoCo 覆盖率中排除 com.ibm 包(或其他任何包),您可以在 pom.xml 文件中配置排除项。这通常在 JaCoCo Maven 插件 配置中完成。


如何在 pom.xml 中排除 com.ibm

您可以在 JaCoCo 插件配置中使用 <excludes> 标签来指定应从覆盖率报告中排除的类或包。

配置示例:

<build>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.11</version> <!-- 请使用最新版本 -->
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
                        <excludes>
                            <!-- 排除所有 com.ibm 包 -->
                            <exclude>com/ibm/**</exclude>
                        </excludes>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

说明:


补充说明:


最佳实践:


Back

mistralai/mistral-medium-3.1

Donate