ディディエ・ロケジュネーブ:
基本的に私はjacocoのみ、機器のテストは一部を必要とするが、全体のpom.xmlをinstrumententingされ、そしてレポートがすべてに来た(「oracle.jdbc.driver」、「com.mysql.jdbc」からのデータ...など)
私はほとんどすべてで数日間しようとしてきました。しかし、私は今のところ成功していません
どのようにここにお知らせ楽器:jacoco楽器全体のpom.xml
[INFO] --- jacoco-maven-plugin:0.8.4:instrument (default-instrument) @ myApp ---
...
[DEBUG] (f) project = MavenProject: com.firstPackage.tdz:myApp:X.1.0 @ C:\rootFolder\my_app\server\MyApp\pom.xml
そして、私のテストが実行中
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ myApp ---
[DEBUG] Source directories: [C:\rootFolder\my_app\server\myApp\tests\src]
[DEBUG] Classpath: [C:\devel\my_app\server\myApp\target\test-classes
これは私のMavenの流れです。
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ myApp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3582 source files to c:\rootFolder\my_app\server\myApp\target\classes
...
[INFO] --- aspectj-maven-plugin:1.3:compile (default) @ myApp ---
...
[INFO] --- jacoco-maven-plugin:0.8.4:instrument (default-instrument) @ myApp ---
...
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ myApp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 326 source files to c:\rootFolder\my_app\server\myApp\target\test-classes
...
[INFO] --- aspectj-maven-plugin:1.3:test-compile (default) @ myApp ---
...
[INFO] --- maven-surefire-plugin:2.15:test (default-test) @ myApp ---
... finally
[INFO] --- jacoco-maven-plugin:0.8.4:restore-instrumented-classes (default-restore-instrumented-classes) @ myApp ---
...
[INFO] --- jacoco-maven-plugin:0.8.4:report (default-report) @ myApp ---
[INFO] Loading execution data file c:\devel\my_app\server\MyApp\target\jacoco.exec
[INFO] Analyzed bundle 'myApp' with 5562 classes
実行は一部のみをテストするために、ここで任意の実際の例では、「Jacocoのデフォルト・楽器」で素晴らしいことです。それはその可能ですか?
<execution>
<id>default-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
<configuration>
<!-- any real example here? Notice maven's behavior above -->
</configuration>
</execution>
ゴダン:
双方jacoco:instrument
とjacoco:report
で動作target/classes
これが実行され、そのカバレッジ測定されるクラスであるので、。
であなたの場所場合target/classes
に比べてより多くのクラスsrc
、そして対応せずinclusions
/ exclusions
彼らはまた、インストルメントと報告されます。
クラスの除外を注意してくださいinstrumentation
からクラスを除外するために十分ではありませんreport
-引用JaCoCoよくある質問:
レポートジェネレータは、クラスは計測から除外したり実行されなかったかを区別することはできません
だから、あなたが適切に実行設定されていることにしてください両方instrument
とreport
の目標を。Mavenのは、異なる目的の異なる実行を設定するには、多くの異なる方法を可能にする、ここで一つだけ例を示します。
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<execution>
<goals>
<goal>instrument</goal>
<goal>report</goal>
</goals>
<configuration>
<!-- this configuration affects this "execution" of "instrument" and "report" goals -->
<excludes>*</excludes>
</configuration>
</execution>