web-dev-qa-db-ja.com

Jacocoパッケージを正しく除外する方法

Jacoco Mavenプラグインバージョン0.8.1(Java 8/Maven 3.1.0)を使用)を使用しています。Jacocoをパス除外で動作させることができません。これらのパッケージを除外したいと思います。

  • my.package.model
  • my.package.exception

私が試したこと:

<build>
      <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.1</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>  
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>my.package.model</exclude>
                        <exclude>my.package.exception</exclude>
                    </excludes>
                </configuration>
            </plugin>
      </plugins>
</build>

<reporting>
        <plugins>
             <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.1</version>
                <configuration>
                    <excludes>
                        <exclude>my.package.model</exclude>
                        <exclude>my.package.exception</exclude>
                    </excludes>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
</reporting>

また(excludes部分の場合):

<excludes>
     <exclude>my.package.model**</exclude>
     <exclude>my.package.exception**</exclude>
</excludes>

<excludes>
     <exclude>my/package/model/**/*</exclude>
     <exclude>my/package/exception/**/*</exclude>
</excludes>

<excludes>
     <exclude>*/my/package/model/**/*</exclude>
     <exclude>*/my/package/exception/**/*</exclude>
</excludes>

<excludes>
     <exclude>**/my/package/model/**/*</exclude>
     <exclude>**/my/package/exception/**/*</exclude>
</excludes>

<excludes>
     <exclude>**/my/package/model/**</exclude>
     <exclude>**/my/package/exception/**</exclude>
</excludes>

<excludes>
     <exclude>**/my/package/model/*</exclude>
     <exclude>**/my/package/exception/*</exclude>
</excludes>

<excludes>
     <exclude>**/model/*</exclude>
     <exclude>**/exception/*</exclude>
</excludes>

<excludes>
     <exclude>**/model**</exclude>
     <exclude>**/exception**</exclude>
</excludes>

最終レポートからこれらのパッケージを削除することはできません...イライラします。

私は読む :

何も機能しません。

何か案が ?

3
cactuschibre

私はそれを持っていて、それは機能します(excludesexecution/configurationにあり、すべてがpluginManagementにあることに注意してください):

<pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>pre-integration-test</id>
                    <goals>
                        <goal>prepare-agent-integration</goal>
                    </goals>
                    <configuration>
                        <destFile>${project.build.directory}/integration-coverage-reports/jacoco-it.exec</destFile>
                        <excludes>
                            <exclude>weblogic/*</exclude>
                        </excludes>
                    </configuration>
                </execution>
                <execution>
                    <id>post-integration-test</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                    <configuration>
                        <dataFile>${project.build.directory}/integration-coverage-reports/jacoco-it.exec</dataFile>
                        <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                        <excludes>
                            <exclude>my/company/package/db/entity/**/*.class</exclude>
                        </excludes>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</pluginManagement>
1
Shadov