diff --git a/docs/hacking-guide/en/SUMMARY.md b/docs/hacking-guide/en/SUMMARY.md
index 376abaa4f5..555605fb28 100644
--- a/docs/hacking-guide/en/SUMMARY.md
+++ b/docs/hacking-guide/en/SUMMARY.md
@@ -5,6 +5,7 @@
* [IDE Integration](ide.md)
* [Building](building.md)
* [Tests](tests.md)
+* [Code coverage report](code-coverage-report.md)
* [Code Formatting](formatting.md)
* [Validating releases](validating-releases.md)
* [Notes for Maintainers](maintainers.md)
diff --git a/docs/hacking-guide/en/code-coverage-report.md b/docs/hacking-guide/en/code-coverage-report.md
new file mode 100644
index 0000000000..9984b7d017
--- /dev/null
+++ b/docs/hacking-guide/en/code-coverage-report.md
@@ -0,0 +1,37 @@
+# Code coverage report
+
+## Getting JaCoCo exec files
+
+Before you can generate code coverage report by JaCoCo tool,
+you need to get data about what lines of code were executed
+during testing. These information are collected by JaCoCo
+agent and stored in JaCoCo exec files. All you need to do
+is run the tests with `jacoco` maven profile.
+
+```
+mvn test -Ptests,extra-tests,jacoco
+```
+
+## Generate JaCoCo reports
+
+```
+mvn verify -Pjacoco-generate-report -DskipTests
+```
+
+For generating JaCoCo reports only run the maven build
+with profile `jacoco-generate-report` as it is shown
+in the example above. After the command was executed,
+in directory `target/jacoco-report` you can find
+reports in HTML and XML formats.
+
+## Merge JaCoCo exec files to one
+
+Since ActiveMQ Artemis is divided into several modules,
+exec files are generated for each module separately.
+If you need to merge them together to have all data
+in one place, you can do it by command below.
+
+```
+mvn jacoco:merge -N -Pjacoco
+```
+
diff --git a/pom.xml b/pom.xml
index ae4bc22afb..81f5196085 100644
--- a/pom.xml
+++ b/pom.xml
@@ -105,6 +105,8 @@
1.7.0
1.1.11.Final
2.9.0
+ 0.7.9
+ 0.7.9
1.4.3
@@ -151,11 +153,15 @@
-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=delay=30s,duration=120s,filename=/tmp/myrecording.jfr
-->
+
+
+
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
-Dlogging.configuration="file:${activemq.basedir}/tests/config/logging.properties"
-Djava.library.path="${activemq.basedir}/artemis-native/bin" -Djgroups.bind_addr=localhost -Dorg.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory.localBindAddress=localhost
-Djava.net.preferIPv4Stack=true -Dbasedir=${basedir}
+ @{jacoco.agent} -Djacoco.agent=@{jacoco.agent}
${project.basedir}
true
@@ -660,6 +666,18 @@
${arquillian.version}
test
+
+ org.jacoco
+ org.jacoco.ant
+ ${version.org.jacoco}
+ test
+
+
+ org.jacoco
+ org.jacoco.core
+ ${version.org.jacoco}
+ test
+
javax.enterprise
cdi-api
@@ -950,6 +968,169 @@
true
+
+
+ jacoco
+
+
+ org.jacoco
+ org.jacoco.core
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+
+
+ jacoco-prepare
+ validate
+
+ prepare-agent
+
+
+ ${project.build.directory}/jacoco.exec
+
+ jacoco.agent
+
+
+
+ merge
+ none
+
+ merge
+
+
+
+
+
+
+ ${activemq.basedir}
+
+ **/*.exec
+
+
+
+
+
+
+
+
+
+
+ jacoco-generate-report
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+
+
+ copy
+
+ process-test-resources
+ false
+
+
+
+ org.jacoco
+ org.jacoco.ant
+ ${version.org.jacoco.plugin}
+
+
+ true
+ ${project.build.directory}/jacoco-jars
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+ post-integration-test
+ run
+ false
+
+
+
+
+
+
+ Creating JaCoCo ActiveMQ Artemis test coverage reports...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.jacoco
+ org.jacoco.ant
+ ${version.org.jacoco.plugin}
+
+
+
+
+
+
@@ -1195,6 +1376,11 @@
artemis-maven-plugin
${project.version}
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${version.org.jacoco.plugin}
+
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java
index c1153bc25f..e66da2c96d 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java
@@ -118,6 +118,11 @@ public final class SpawnedVMSupport {
commandList.add("-Djava.util.logging.config.file=" + loggingConfigFile + " ");
}
+ String jacocoAgent = System.getProperty("jacoco.agent");
+ if (jacocoAgent != null && !jacocoAgent.isEmpty()) {
+ commandList.add(jacocoAgent);
+ }
+
String loggingPlugin = System.getProperty("org.jboss.logging.Logger.pluginClass");
if (loggingPlugin != null) {
commandList.add("-Dorg.jboss.logging.Logger.pluginClass=" + loggingPlugin + " ");