[
https://issues.apache.org/jira/browse/ARTEMIS-1265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16094731#comment-16094731
]
ASF GitHub Bot commented on ARTEMIS-1265:
-----------------------------------------
Github user dudaerich commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1380#discussion_r128524216
--- Diff: pom.xml ---
@@ -948,6 +966,169 @@
<skipTests>true</skipTests>
</properties>
</profile>
+ <!-- This profile generates jacoco coverage files. To generate html
report use "-Pjacoco-generate-report" -->
+ <profile>
+ <id>jacoco</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jacoco</groupId>
+ <artifactId>org.jacoco.core</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jacoco-prepare</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+
<destFile>${project.build.directory}/jacoco.exec</destFile>
+ <!-- Jacoco sets this property with agent
configuration.
+ This property is passed to
maven-surefire-plugin -->
+ <propertyName>jacoco.agent</propertyName>
+ </configuration>
+ </execution>
+ <execution>
+ <id>merge</id>
+ <phase>none</phase>
+ <goals>
+ <goal>merge</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <fileSets>
+ <fileSet
implementation="org.apache.maven.shared.model.fileset.FileSet">
+ <directory>${activemq.basedir}</directory>
+ <includes>
+ <include>**/*.exec</include>
--- End diff --
I looked at the `report-aggregate` goal and if I understand it correctly it
doesn't fit to our case. Let me explain.
You can run this goal in the module with tests. The plugin automatically
collects all jars/classes on which the module with test depends and use them
for generating the report. So it generates separate report for each module with
tests.
What this PR does is that at first all tests are started with Jacoco agent,
so each module with tests generates jacoco.exec file. Then ant goal collects
these files using the pattern `**/target/jacoco.exec` and generates report.
The `merge` goal is not necessary for generating the report. However it is
useful if you want to merge all jacoco.exec files into the one and use it
somewhere else. E.g. you can take the jacoco.exec file and merge it with
different test suite - e.g. with wildfly's tests.
> JaCoCo profile for getting code coverage report
> -----------------------------------------------
>
> Key: ARTEMIS-1265
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1265
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Affects Versions: 1.5.5, 2.1.0
> Reporter: Erich Duda
>
> JaCoCo \[1\] is a free code coverage library for Java. Code coverage is
> useful metric for revealing untested areas of code.
> \[1\] www.jacoco.org/jacoco/
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)