Skip to content

Commit 49e97b8

Browse files
committed
Add maven profile to run test coverage analysis with jacoco
1 parent 91cd55e commit 49e97b8

File tree

1 file changed

+37
-27
lines changed

1 file changed

+37
-27
lines changed

pom.xml

+37-27
Original file line numberDiff line numberDiff line change
@@ -205,33 +205,6 @@
205205
</execution>
206206
</executions>
207207
</plugin>
208-
<plugin>
209-
<groupId>org.jacoco</groupId>
210-
<artifactId>jacoco-maven-plugin</artifactId>
211-
<version>${jacoco-maven-plugin.version}</version>
212-
<executions>
213-
<execution>
214-
<id>pre-unit-test</id>
215-
<goals>
216-
<goal>prepare-agent</goal>
217-
</goals>
218-
<configuration>
219-
<propertyName>surefireArgLine</propertyName>
220-
<destFile>${project.build.directory}/jacoco.exec</destFile>
221-
</configuration>
222-
</execution>
223-
<execution>
224-
<id>post-unit-test</id>
225-
<phase>test</phase>
226-
<goals>
227-
<goal>report</goal>
228-
</goals>
229-
<configuration>
230-
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
231-
</configuration>
232-
</execution>
233-
</executions>
234-
</plugin>
235208
<plugin>
236209
<groupId>org.codehaus.mojo</groupId>
237210
<artifactId>flatten-maven-plugin</artifactId>
@@ -267,6 +240,43 @@
267240
</plugins>
268241
</build>
269242

243+
<profiles>
244+
<profile>
245+
<id>test-coverage</id>
246+
<build>
247+
<plugins>
248+
<plugin>
249+
<groupId>org.jacoco</groupId>
250+
<artifactId>jacoco-maven-plugin</artifactId>
251+
<version>${jacoco-maven-plugin.version}</version>
252+
<executions>
253+
<execution>
254+
<id>pre-unit-test</id>
255+
<goals>
256+
<goal>prepare-agent</goal>
257+
</goals>
258+
<configuration>
259+
<propertyName>surefireArgLine</propertyName>
260+
<destFile>${project.build.directory}/jacoco.exec</destFile>
261+
</configuration>
262+
</execution>
263+
<execution>
264+
<id>post-unit-test</id>
265+
<phase>test</phase>
266+
<goals>
267+
<goal>report</goal>
268+
</goals>
269+
<configuration>
270+
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
271+
</configuration>
272+
</execution>
273+
</executions>
274+
</plugin>
275+
</plugins>
276+
</build>
277+
</profile>
278+
</profiles>
279+
270280
<repositories>
271281
<repository>
272282
<id>maven-central</id>

0 commit comments

Comments
 (0)