diff --git a/README.md b/README.md index b246a466306fa54fa55d4446fab8b0d89212accd..9086da675ff4195aef712d56010382de8084eb58 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 6fd4562d9d3012871ae676b694d4d87d54d0b5e9..e5814d7e3f842eda47766f182a220716cce73dff 100644 --- a/templates/gitlab-ci-maven.yml +++ b/templates/gitlab-ci-maven.yml @@ -629,6 +629,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"