Hi there,
I think your tool is quite nice to deal with test reports but I'm facing some problems to make it work with maven 2.2.1 (this version is required), Spring 2.5.6 and integration test with JUnit (failsafe-plugin).
I have added the jacoco-maven-plugin to my pom this way:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.5.3.201107060350</version>
<configuration>
<destfile>${basedir}/target/coverage-reports/jacoco-unit.exec</destfile>
<datafile>${basedir}/target/coverage-reports/jacoco-unit.exec</datafile>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<excludes>*_javassist_*</excludes>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<excludes>*_javassist_*</excludes>
</configuration>
</execution>
</executions>
</plugin>
What I'm doing is next, I use the jetty-maven-plugin to run my integration tests in the integration phase :). Everything works nicely, test are executed properly but I cannot generate jacoco reports from them.
I have tried several things:
- Exclude from the prepare-agent goal those packages than don't contain any of my integration test, i.e, packages within src/main/java and include those that implement my integration test. Output: no report about integration classes is generated, but jacoco.exec just contains some information (just the name of the integration classes) about my integration classes. The weird thing about it is that if I inspect the site folder I have information about any class within the src/main/java folder, but none about my integration classes.
pom.xml:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.5.3.201107060350</version>
<configuration>
<destfile>${basedir}/target/coverage-reports/jacoco-unit.exec</destfile>
<datafile>${basedir}/target/coverage-reports/jacoco-unit.exec</datafile>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<excludes>*_javassist_*:packages_within_src/main/java/.*</excludes>
<includes>integration_test_package.*</includes>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<excludes>*_javassist_*:packages_within_src/main/java/.*</excludes>
<includes>integration_test_package.*</includes>
</configuration>
</execution>
</executions>
</plugin>
- Using a newer plugin version:
1) With the excludes and include configuration as previously.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<!--<version>0.5.3.201107060350</version>-->
<version>0.5.10.201208310627</version>
<configuration>
<destfile>${basedir}/target/coverage-reports/jacoco-unit.exec</destfile>
<datafile>${basedir}/target/coverage-reports/jacoco-unit.exec</datafile>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<excludes>*_javassist_*:packages_within_src/main/java/.*</excludes>
<includes>integration_test_package.*</includes>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<excludes>*_javassist_*:packages_within_src/main/java/.*</excludes>
<includes>integration_test_package.*</includes>
</configuration>
</execution>
</executions>
</plugin>
I get the following error:
[INFO] Failed to configure plugin parameters for: org.jacoco:jacoco-maven-plugin:0.5.10.201208310627
(found static expression: '*_javassist_*:
packages_within_src/main/java/.* ' which may act as a default value).
Cause: Cannot assign configuration entry 'excludes' to 'interface java.util.List' from '*_javassist_*:
packages_within_src/main/java/.* .*', which is of type class java.lang.String
2) With the includes configuration as previously. I get the same as before but refer to the includes configuration.
3) Without includes and excludes configuration. I get this type of error in the integration tests:
$$_javassist_15, method: <clinit> signature: ()V) Illegal local variable number
4) Using this plugin configuration. I get this:
Cause: Cannot assign configuration entry 'excludes' to 'interface java.util.List' from '*_javassist_*', which is of type class java.lang.String
After reading some posts I'm not sure if the jacoco maven plugin can be used along with maven 2.2.1 + integration tests. I'm also using failsafe to generate reports and works fine, but I'd like to use jacoco in order to use it with Hudson.
Thank you!!