diff --git a/docs/src/main/asciidoc/tests-with-coverage.adoc b/docs/src/main/asciidoc/tests-with-coverage.adoc
index 4ec98913dcf62..b414bd58e6149 100644
--- a/docs/src/main/asciidoc/tests-with-coverage.adoc
+++ b/docs/src/main/asciidoc/tests-with-coverage.adoc
@@ -170,6 +170,26 @@ config is required.
WARNING: Using both the extension and the plugin requires special configuration, if you add both you will get lots of errors about classes
already being instrumented. The configuration needed is detailed below.
+== Working with multi-module projects
+
+Up until `3.2`, `data-file` and `report-location` were always relative to the module's build output directory, which prevented from
+working with multi-module projects where you want to aggregate all coverages into a single parent directory. Starting in `3.3`,
+specifying a `data-file` or `report-location` will assume the path as is. Here is an example on how to set up the `surefire` plugin:
+
+[source, xml]
+----
+
+ maven-surefire-plugin
+
+
+ ${maven.multiModuleProjectDirectory}/target/jacoco.exec
+ true
+ ${maven.multiModuleProjectDirectory}/target/coverage
+
+
+ transforme
return;
}
- String dataFile = getFilePath(config.dataFile, outputTargetBuildItem.getOutputDirectory(), JACOCO_QUARKUS_EXEC);
+ String dataFile = getFilePath(config.dataFile, outputTargetBuildItem.getOutputDirectory(),
+ JacocoConfig.JACOCO_QUARKUS_EXEC);
System.setProperty("jacoco-agent.destfile", dataFile);
if (!config.reuseDataFile) {
Files.deleteIfExists(Paths.get(dataFile));
@@ -97,7 +95,7 @@ public byte[] apply(String className, byte[] bytes) {
info.dataFile = dataFile;
File targetdir = new File(
- getFilePath(config.reportLocation, outputTargetBuildItem.getOutputDirectory(), JACOCO_REPORT));
+ getFilePath(config.reportLocation, outputTargetBuildItem.getOutputDirectory(), JacocoConfig.JACOCO_REPORT));
info.reportDir = targetdir.getAbsolutePath();
String includes = String.join(",", config.includes);
String excludes = String.join(",", config.excludes.orElse(Collections.emptyList()));
@@ -123,7 +121,8 @@ public byte[] apply(String className, byte[] bytes) {
private void addProjectModule(ResolvedDependency module, JacocoConfig config, ReportInfo info, String includes,
String excludes, Set classes, Set sources) throws Exception {
- String dataFile = getFilePath(config.dataFile, module.getWorkspaceModule().getBuildDir().toPath(), JACOCO_QUARKUS_EXEC);
+ String dataFile = getFilePath(config.dataFile, module.getWorkspaceModule().getBuildDir().toPath(),
+ JacocoConfig.JACOCO_QUARKUS_EXEC);
info.savedData.add(new File(dataFile).getAbsolutePath());
if (module.getSources() == null) {
return;
diff --git a/test-framework/jacoco/runtime/src/main/java/io/quarkus/jacoco/runtime/JacocoConfig.java b/test-framework/jacoco/runtime/src/main/java/io/quarkus/jacoco/runtime/JacocoConfig.java
index 4e5738cdd9288..d9beb42898049 100644
--- a/test-framework/jacoco/runtime/src/main/java/io/quarkus/jacoco/runtime/JacocoConfig.java
+++ b/test-framework/jacoco/runtime/src/main/java/io/quarkus/jacoco/runtime/JacocoConfig.java
@@ -3,6 +3,7 @@
import java.util.List;
import java.util.Optional;
+import io.quarkus.runtime.annotations.ConfigDocDefault;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
@@ -10,11 +11,17 @@
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
public class JacocoConfig {
+ public static final String JACOCO_QUARKUS_EXEC = "jacoco-quarkus.exec";
+ public static final String JACOCO_REPORT = "jacoco-report";
+ public static final String TARGET_JACOCO_QUARKUS_EXEC = "target/" + JACOCO_QUARKUS_EXEC;
+ public static final String TARGET_JACOCO_REPORT = "target/" + JACOCO_REPORT;
+
/**
- * The jacoco data file. By default this will be target/jacoco-quarkus.exec.
+ * The jacoco data file.
* The path can be relative (to the module) or absolute.
*/
@ConfigItem
+ @ConfigDocDefault(TARGET_JACOCO_QUARKUS_EXEC)
public Optional dataFile;
/**
@@ -83,9 +90,10 @@ public class JacocoConfig {
public Optional> excludes;
/**
- * The location of the report files. By default this will be target/jacoco-report.
+ * The location of the report files.
* The path can be relative (to the module) or absolute.
*/
@ConfigItem
+ @ConfigDocDefault(TARGET_JACOCO_REPORT)
public Optional reportLocation;
}