DATAJPA-826 - Added Jacoco to test executions explicitly.

To make sure the coverage data is collected for all test executions, we now explicitly add the Jacoco Java agent to the test executions.

Added Jacoco plugin explicitly to make sure the agent can be resolved even if the build is not run in sonarcube profile.
This commit is contained in:
Oliver Gierke
2015-11-26 18:30:39 +01:00
parent 51ff07c04c
commit a3b6ca6a26

28
pom.xml
View File

@@ -276,6 +276,28 @@
<build>
<plugins>
<!--
Jacoco plugin redeclared to make sure it's downloaded and
the agents can be explicitly added to the test executions.
-->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco}</version>
<configuration>
<destFile>${jacoco.destfile}</destFile>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -337,7 +359,7 @@
<exclude>**/OpenJpa*</exclude>
<exclude>**/EclipseLink*</exclude>
</excludes>
<argLine>-javaagent:${settings.localRepository}/org/springframework/spring-instrument/${spring}/spring-instrument-${spring}.jar</argLine>
<argLine>-javaagent:${settings.localRepository}/org/springframework/spring-instrument/${spring}/spring-instrument-${spring}.jar -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco}/org.jacoco.agent-${jacoco}-runtime.jar=destfile=${jacoco.destfile}</argLine>
</configuration>
</execution>
<execution>
@@ -350,7 +372,7 @@
<includes>
<include>**/EclipseLink*Tests.java</include>
</includes>
<argLine>-javaagent:${settings.localRepository}/org/eclipse/persistence/org.eclipse.persistence.jpa/${eclipselink}/org.eclipse.persistence.jpa-${eclipselink}.jar -javaagent:${settings.localRepository}/org/springframework/spring-instrument/${spring}/spring-instrument-${spring}.jar</argLine>
<argLine>-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco}/org.jacoco.agent-${jacoco}-runtime.jar=destfile=${jacoco.destfile} -javaagent:${settings.localRepository}/org/eclipse/persistence/org.eclipse.persistence.jpa/${eclipselink}/org.eclipse.persistence.jpa-${eclipselink}.jar -javaagent:${settings.localRepository}/org/springframework/spring-instrument/${spring}/spring-instrument-${spring}.jar</argLine>
</configuration>
</execution>
<execution>
@@ -363,7 +385,7 @@
<includes>
<include>**/OpenJpa*Tests.java</include>
</includes>
<argLine>-javaagent:${settings.localRepository}/org/apache/openjpa/openjpa/${openjpa}/openjpa-${openjpa}.jar</argLine>
<argLine>-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco}/org.jacoco.agent-${jacoco}-runtime.jar=destfile=${jacoco.destfile} -javaagent:${settings.localRepository}/org/apache/openjpa/openjpa/${openjpa}/openjpa-${openjpa}.jar</argLine>
<classpathDependencyExcludes>
<classpathDepencyExclude>org.hsqldb:hsqldb</classpathDepencyExclude>
</classpathDependencyExcludes>