Skip to content

Commit

Permalink
DATAJPA-826 - Added Jacoco to test executions explicitly.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
odrotbohm committed Nov 26, 2015
1 parent 51ff07c commit a3b6ca6
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit a3b6ca6

Please sign in to comment.