diff --git a/README.md b/README.md index 81a44c87c01e99527930a26b5c0bd9650e026a75..b63f24932a1f956b45eeec10a3928248bb77c348 100644 --- a/README.md +++ b/README.md @@ -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). -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 following: * 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 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: diff --git a/templates/gitlab-ci-maven.yml b/templates/gitlab-ci-maven.yml index 49a20939e1423d770ea5e5577b4cd33235767023..84d5bb8ddd5bf669c8d6d13c70af58104070563f 100644 --- a/templates/gitlab-ci-maven.yml +++ b/templates/gitlab-ci-maven.yml @@ -634,6 +634,9 @@ mvn-build: reports: junit: - "${MAVEN_PROJECT_DIR}/**/target/*-reports/TEST-*.xml" + coverage_report: + coverage_format: jacoco + path: "${MAVEN_PROJECT_DIR}/**/target/site/jacoco/jacoco.xml" paths: # version may have been altered - "${MAVEN_PROJECT_DIR}/**/pom.xml"