Merge pull request #1079 from gsmet/fix-jacoco-java16

Fix JaCoCo execution when we have additional Surefire options
This commit is contained in:
Liam Newman
2021-04-05 14:11:01 -07:00
committed by GitHub
2 changed files with 31 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ jobs:
- name: Maven Install (skipTests)
env:
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
run: mvn -B install -DskipTests -D enable-ci --file pom.xml
run: mvn -B install -DskipTests --file pom.xml
site:
name: site (Java ${{ matrix.java }})
runs-on: ubuntu-latest

32
pom.xml
View File

@@ -46,6 +46,7 @@
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
<jjwt.suite.version>0.11.2</jjwt.suite.version>
<jacoco.surefire.argLine />
<surefire.argLine />
</properties>
@@ -107,6 +108,9 @@
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacoco.surefire.argLine</propertyName>
</configuration>
</execution>
<!-- attached to Maven test phase -->
<execution>
@@ -274,7 +278,7 @@
<id>default-test</id>
<configuration>
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
<argLine>${surefire.argLine}</argLine>
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine}</argLine>
</configuration>
</execution>
</executions>
@@ -582,7 +586,7 @@
<!-- There are some tests that take longer or are a little
flaky. Run them here. -->
<includesFile>src/test/resources/slow-or-flaky-tests.txt</includesFile>
<argLine>${surefire.argLine}</argLine>
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine}</argLine>
</configuration>
</execution>
</executions>
@@ -642,6 +646,30 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-jacoco-exist</id>
<phase>verify</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireFilesExist>
<files>
<file>${project.build.directory}/jacoco.exec</file>
</files>
</requireFilesExist>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>