Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-45546] Add jacoco code coverage to Declarative builds
Note that we're not using the Jacoco plugin - it's not installed on
ci.jenkins.io in the first place, and I think the real value is
probably going to come from the XML file anyway, which can be slurped
in by other tools.
  • Loading branch information
abayer committed Jul 18, 2017
1 parent 6c65ef8 commit 39a51ef
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Jenkinsfile
Expand Up @@ -35,9 +35,11 @@ pipeline {
}
success {
archive "**/target/*.hpi"
archive "**/target/site/jacoco/jacoco.xml"
}
unstable {
archive "**/target/*.hpi"
archive "**/target/site/jacoco/jacoco.xml"
}
}

Expand Down
39 changes: 39 additions & 0 deletions pom.xml
Expand Up @@ -257,6 +257,45 @@
<tagNameFormat>pipeline-model-definition-@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->

<dataFile>target/jacoco.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>target/jacoco-ut</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit 39a51ef

Please sign in to comment.