Include runtime dependencies in aggregated reports (#502)
diff --git a/jacoco-maven-plugin.test/it/it-report-aggregate/report/pom.xml b/jacoco-maven-plugin.test/it/it-report-aggregate/report/pom.xml
index 7bde0ad..4abfd4b 100644
--- a/jacoco-maven-plugin.test/it/it-report-aggregate/report/pom.xml
+++ b/jacoco-maven-plugin.test/it/it-report-aggregate/report/pom.xml
@@ -21,12 +21,13 @@
<artifactId>report</artifactId>
<name>Aggregate Report</name>
-
+
<dependencies>
<dependency>
<groupId>jacoco</groupId>
<artifactId>child1</artifactId>
<version>${project.version}</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>jacoco</groupId>
@@ -38,6 +39,7 @@
<groupId>jacoco</groupId>
<artifactId>child2</artifactId>
<version>${project.version}</version>
+ <scope>runtime</scope>
</dependency>
</dependencies>
diff --git a/jacoco-maven-plugin/src/org/jacoco/maven/ReportAggregateMojo.java b/jacoco-maven-plugin/src/org/jacoco/maven/ReportAggregateMojo.java
index ac4b21d..abd9a04 100644
--- a/jacoco-maven-plugin/src/org/jacoco/maven/ReportAggregateMojo.java
+++ b/jacoco-maven-plugin/src/org/jacoco/maven/ReportAggregateMojo.java
@@ -42,8 +42,8 @@
* </p>
*
* <ul>
- * <li><code>compile</code>: Project source and execution data is included in
- * the report.</li>
+ * <li><code>compile</code>, <code>runtime</code>: Project source and execution
+ * data is included in the report.</li>
* <li><code>test</code>: Only execution data is considered for the report.</li>
* </ul>
*
@@ -105,7 +105,8 @@
dataFileExcludes);
loadExecutionData(support, filter, getProject().getBasedir());
for (final MavenProject dependency : findDependencies(
- Artifact.SCOPE_COMPILE, Artifact.SCOPE_TEST)) {
+ Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME,
+ Artifact.SCOPE_TEST)) {
loadExecutionData(support, filter, dependency.getBasedir());
}
}
@@ -128,7 +129,8 @@
void createReport(final IReportGroupVisitor visitor,
final ReportSupport support) throws IOException {
final IReportGroupVisitor group = visitor.visitGroup(title);
- for (final MavenProject dependency : findDependencies(Artifact.SCOPE_COMPILE)) {
+ for (final MavenProject dependency : findDependencies(
+ Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME)) {
support.processProject(group, dependency.getArtifactId(),
dependency, getIncludes(), getExcludes(), sourceEncoding);
}
diff --git a/org.jacoco.doc/docroot/doc/changes.html b/org.jacoco.doc/docroot/doc/changes.html
index 34b36b2..80d7fb7 100644
--- a/org.jacoco.doc/docroot/doc/changes.html
+++ b/org.jacoco.doc/docroot/doc/changes.html
@@ -25,6 +25,8 @@
<li>Exclude from a report enum methods <code>valueOf</code> and <code>values</code>
that are created by compiler
(GitHub <a href="https://github.com/jacoco/jacoco/issues/491">#491</a>).</li>
+ <li>Maven aggregated reports will now also include modules of runtime dependencies
+ (GitHub <a href="https://github.com/jacoco/jacoco/issues/498">#498</a>).</li>
</ul>
<h2>Release 0.7.9 (2017/02/05)</h2>