Skip to content
Snippets Groups Projects
Commit 89a15fc2 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'feat/jacoco-integration' into 'master'

feat(JaCoCo): add JaCoCo Coverage Reports integration

See merge request to-be-continuous/maven!95
parents a177cbaf 1f997a18
No related branches found
No related tags found
No related merge requests found
...@@ -89,14 +89,15 @@ to compute code coverage during unit tests execution. ...@@ -89,14 +89,15 @@ to compute code coverage during unit tests execution.
In addition it makes the necessary to [integrate code coverage stats into your GitLab project](https://docs.gitlab.com/ee/ci/testing/code_coverage.html#view-code-coverage-results-in-the-mr) (report badge and viewable coverage in merge requests). In addition it makes the necessary to [integrate code coverage stats into your GitLab project](https://docs.gitlab.com/ee/ci/testing/code_coverage.html#view-code-coverage-results-in-the-mr) (report badge and viewable coverage in merge requests).
If yo want to fix the JaCoCo plugin version or tweak the default configuration, you may have to configure the If you want to fix the JaCoCo plugin version or tweak the default configuration, you may have to configure the
[JaCoCo Maven Plugin](https://www.eclemma.org/jacoco/trunk/doc/maven.html) in your `pom.xml`, but be aware of the [JaCoCo Maven Plugin](https://www.eclemma.org/jacoco/trunk/doc/maven.html) in your `pom.xml`, but be aware of the
following: following:
* do not declare JaCoCo executions for `prepare-agent` and `report` goals as each would run twice during * do not declare JaCoCo executions for `prepare-agent` and `report` goals as each would run twice during
unit tests (not necessarily with the expected configuration). If you really need to do so anyway, you'll have to unit tests (not necessarily with the expected configuration). If you really need to do so anyway, you'll have to
override the `$MAVEN_BUILD_ARGS` variable to remove the explicit invocation to JaCoCo goals. override the `$MAVEN_BUILD_ARGS` variable to remove the explicit invocation to JaCoCo goals.
* make sure the `report` goal computes a CSV report, that is used by the Maven template to compute the global coverage stat. * make sure the `report` goal computes a CSV report (that's default behavior), that is used by the Maven template to compute the global coverage stat,
* make sure the `report` goal computes an XML report (that's default behavior), that is required to support [GitLab code coverage intergation](https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization/jacoco.html).
More info: More info:
......
...@@ -634,6 +634,9 @@ mvn-build: ...@@ -634,6 +634,9 @@ mvn-build:
reports: reports:
junit: junit:
- "${MAVEN_PROJECT_DIR}/**/target/*-reports/TEST-*.xml" - "${MAVEN_PROJECT_DIR}/**/target/*-reports/TEST-*.xml"
coverage_report:
coverage_format: jacoco
path: "${MAVEN_PROJECT_DIR}/**/target/site/jacoco/jacoco.xml"
paths: paths:
# version may have been altered # version may have been altered
- "${MAVEN_PROJECT_DIR}/**/pom.xml" - "${MAVEN_PROJECT_DIR}/**/pom.xml"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment