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 87d0bdcdb7..6698f16c68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,6 +102,8 @@
2.0.0.Beta3
1.7.0
1.1.11.Final
+ 0.7.9
+ 0.7.9
1.4.3
@@ -147,7 +149,7 @@
-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
@@ -648,6 +650,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
@@ -947,6 +961,179 @@
true
+
+
+ jacoco
+
+
+ org.jacoco
+ org.jacoco.core
+
+
+
+
+
+
+
+ -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}
+
+
+
+
+
+ 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}
+
+
+
+
+
+
@@ -1191,6 +1378,11 @@
artemis-maven-plugin
${project.version}
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${version.org.jacoco.plugin}
+
diff --git a/scripts/jacoco.sh b/scripts/jacoco.sh
new file mode 100755
index 0000000000..b70b27d0be
--- /dev/null
+++ b/scripts/jacoco.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+mvn -Ptests,jacoco -DfailIfNoTests=false -Pextra-tests -DskipStyleCheck=true -DskipPerformanceTests=false -Dtest=$1 test
+mvn jacoco:merge -N -Pjacoco
+mvn verify -Pjacoco-generate-report -DskipTests
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 703c84807b..a8593f2d94 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
@@ -110,6 +110,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 + " ");