Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jacoco/jacoco
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: GEBIT/jacoco
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: gebit
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 4 commits
  • 25 files changed
  • 2 contributors

Commits on Sep 25, 2024

  1. Add option to aggregate automatically reports from aggregators, no ne…

    …ed to add any dependency
    
    Signed-off-by: Olivier Lamy <[email protected]>
    olamy committed Sep 25, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    olamy Olivier Lamy
    Copy the full SHA
    59f7f5e View commit details

Commits on Nov 28, 2024

  1. GBLD-1545: Add ReportAggregateAllMojo

    Move changes from 59f7f5e into
    dedicated ReportAggregateMojo.java with just "aggregator = true"
    cpfeiffer committed Nov 28, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    cpfeiffer Carsten Pfeiffer
    Copy the full SHA
    ead9d93 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    cpfeiffer Carsten Pfeiffer
    Copy the full SHA
    08981ac View commit details
  3. Build with gebit-build

    cpfeiffer committed Nov 28, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    cpfeiffer Carsten Pfeiffer
    Copy the full SHA
    6702973 View commit details
Showing with 838 additions and 112 deletions.
  1. +104 −104 .azure-pipelines/azure-pipelines.yml
  2. +12 −0 development/jenkins_job.properties
  3. +136 −0 development/settings.xml
  4. +34 −0 jacoco-maven-plugin.test/it/it-report-aggregate-reactors/child1-test/pom.xml
  5. +24 −0 ...plugin.test/it/it-report-aggregate-reactors/child1-test/src/test/java/package1/Example1bTest.java
  6. +26 −0 jacoco-maven-plugin.test/it/it-report-aggregate-reactors/child1/pom.xml
  7. +20 −0 ...co-maven-plugin.test/it/it-report-aggregate-reactors/child1/src/main/java/package1/Example1a.java
  8. +20 −0 ...co-maven-plugin.test/it/it-report-aggregate-reactors/child1/src/main/java/package1/Example1b.java
  9. +24 −0 ...aven-plugin.test/it/it-report-aggregate-reactors/child1/src/test/java/package1/Example1aTest.java
  10. +26 −0 jacoco-maven-plugin.test/it/it-report-aggregate-reactors/child2/pom.xml
  11. +20 −0 jacoco-maven-plugin.test/it/it-report-aggregate-reactors/child2/src/main/java/package2/Example2.java
  12. +24 −0 ...maven-plugin.test/it/it-report-aggregate-reactors/child2/src/test/java/package2/Example2Test.java
  13. +26 −0 jacoco-maven-plugin.test/it/it-report-aggregate-reactors/child2v2/pom.xml
  14. +20 −0 ...o-maven-plugin.test/it/it-report-aggregate-reactors/child2v2/src/main/java/package2/Example2.java
  15. +24 −0 ...ven-plugin.test/it/it-report-aggregate-reactors/child2v2/src/test/java/package2/Example2Test.java
  16. +50 −0 jacoco-maven-plugin.test/it/it-report-aggregate-reactors/pom.xml
  17. +44 −0 jacoco-maven-plugin.test/it/it-report-aggregate-reactors/report/pom.xml
  18. +23 −0 ...en-plugin.test/it/it-report-aggregate-reactors/report/src/test/java/packagereport/ReportTest.java
  19. +53 −0 jacoco-maven-plugin.test/it/it-report-aggregate-reactors/verify.bsh
  20. +65 −0 jacoco-maven-plugin/src/org/jacoco/maven/ReportAggregateAllMojo.java
  21. +4 −5 jacoco-maven-plugin/src/org/jacoco/maven/ReportAggregateMojo.java
  22. +11 −2 org.jacoco.build/pom.xml
  23. +1 −1 org.jacoco.core.test.validation.scala/pom.xml
  24. +5 −0 org.jacoco.examples.test/pom.xml
  25. +42 −0 pom.xml
208 changes: 104 additions & 104 deletions .azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,105 +1,105 @@
jobs:
- job:
strategy:
matrix:
JDK 5:
JDK_VERSION: 5
JDK 6:
JDK_VERSION: 6
JDK 7:
JDK_VERSION: 7
JDK 8:
JDK_VERSION: 8
JDK 9:
JDK_VERSION: 9
JDK 10:
JDK_VERSION: 10
JDK 11:
JDK_VERSION: 11
JDK 11 with ECJ:
JDK_VERSION: 11
ECJ: true
JDK 12:
JDK_VERSION: 12
JDK 13:
JDK_VERSION: 13
JDK 14:
JDK_VERSION: 14
JDK 15:
JDK_VERSION: 15
JDK 16:
JDK_VERSION: 16
JDK 17:
JDK_VERSION: 17
JDK 17 with ECJ:
JDK_VERSION: 17
ECJ: true
JDK 18:
JDK_VERSION: 18
JDK 19:
JDK_VERSION: 19
JDK 20:
JDK_VERSION: 20
JDK 21:
JDK_VERSION: 21
JDK 21 with ECJ:
JDK_VERSION: 21
ECJ: true
JDK 22:
JDK_VERSION: 22
JDK 23:
JDK_VERSION: 23
JDK 24:
JDK_VERSION: 24
pool:
vmImage: 'ubuntu-20.04'
steps:
- bash: |
set -e
url_var=JDK${JDK_VERSION}_URL
JDK_URL=${!url_var}
mkdir .jdk
curl -L $JDK_URL -o .jdk/jdk.tar.gz
tar -xzf .jdk/jdk.tar.gz -C .jdk --strip-components 1
.jdk/bin/java -version
echo "
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<id>$JDK_VERSION</id>
<version>$JDK_VERSION</version>
</provides>
<configuration>
<jdkHome>$PWD/.jdk</jdkHome>
</configuration>
</toolchain>
</toolchains>
" > toolchains.xml
displayName: Setup JDK
- bash: |
if [[ "$JDK_VERSION" -ge "17" ]]; then
export JAVA_HOME=$PWD/.jdk
else
export JAVA_HOME=$JAVA_HOME_17_X64
fi
if [[ "$BUILD_SOURCEBRANCH" == "refs/heads/master" && "$JDK_VERSION" == "5" ]]; then
./mvnw -V -B -e --no-transfer-progress -f org.jacoco.build \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION \
deploy:deploy -DdeployAtEnd \
--toolchains=toolchains.xml --settings=.azure-pipelines/maven-settings.xml
elif [[ "$BUILD_SOURCEBRANCH" == "refs/heads/master" && "$JDK_VERSION" == "11" ]]; then
./mvnw -V -B -e --no-transfer-progress -f org.jacoco.build \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION \
sonar:sonar \
--toolchains=toolchains.xml --settings=.azure-pipelines/maven-settings.xml
else
./mvnw -V -B -e --no-transfer-progress \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION -Decj=${ECJ:-} \
--toolchains=toolchains.xml
fi
displayName: Build
env:
SONARQUBE_TOKEN: $(SONARQUBE_TOKEN)
SONATYPE_USERNAME: $(SONATYPE_USERNAME)
SONATYPE_PASSWORD: $(SONATYPE_PASSWORD)
- job:
strategy:
matrix:
JDK 5:
JDK_VERSION: 5
JDK 6:
JDK_VERSION: 6
JDK 7:
JDK_VERSION: 7
JDK 8:
JDK_VERSION: 8
JDK 9:
JDK_VERSION: 9
JDK 10:
JDK_VERSION: 10
JDK 11:
JDK_VERSION: 11
JDK 11 with ECJ:
JDK_VERSION: 11
ECJ: true
JDK 12:
JDK_VERSION: 12
JDK 13:
JDK_VERSION: 13
JDK 14:
JDK_VERSION: 14
JDK 15:
JDK_VERSION: 15
JDK 16:
JDK_VERSION: 16
JDK 17:
JDK_VERSION: 17
JDK 17 with ECJ:
JDK_VERSION: 17
ECJ: true
JDK 18:
JDK_VERSION: 18
JDK 19:
JDK_VERSION: 19
JDK 20:
JDK_VERSION: 20
JDK 21:
JDK_VERSION: 21
JDK 21 with ECJ:
JDK_VERSION: 21
ECJ: true
JDK 22:
JDK_VERSION: 22
JDK 23:
JDK_VERSION: 23
JDK 24:
JDK_VERSION: 24
pool:
vmImage: 'ubuntu-20.04'
steps:
- bash: |
set -e
url_var=JDK${JDK_VERSION}_URL
JDK_URL=${!url_var}
mkdir .jdk
curl -L $JDK_URL -o .jdk/jdk.tar.gz
tar -xzf .jdk/jdk.tar.gz -C .jdk --strip-components 1
.jdk/bin/java -version
echo "
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<id>$JDK_VERSION</id>
<version>$JDK_VERSION</version>
</provides>
<configuration>
<jdkHome>$PWD/.jdk</jdkHome>
</configuration>
</toolchain>
</toolchains>
" > toolchains.xml
displayName: Setup JDK
- bash: |
if [[ "$JDK_VERSION" -ge "17" ]]; then
export JAVA_HOME=$PWD/.jdk
else
export JAVA_HOME=$JAVA_HOME_17_X64
fi
if [[ "$BUILD_SOURCEBRANCH" == "refs/heads/master" && "$JDK_VERSION" == "5" ]]; then
./mvnw -V -B -e --no-transfer-progress -f org.jacoco.build \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION \
deploy:deploy -DdeployAtEnd \
--toolchains=toolchains.xml --settings=.azure-pipelines/maven-settings.xml
elif [[ "$BUILD_SOURCEBRANCH" == "refs/heads/master" && "$JDK_VERSION" == "11" ]]; then
./mvnw -V -B -e --no-transfer-progress -f org.jacoco.build \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION \
sonar:sonar \
--toolchains=toolchains.xml --settings=.azure-pipelines/maven-settings.xml
else
./mvnw -V -B -e --no-transfer-progress \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION -Decj=${ECJ:-} \
--toolchains=toolchains.xml
fi
displayName: Build
env:
SONARQUBE_TOKEN: $(SONARQUBE_TOKEN)
SONATYPE_USERNAME: $(SONATYPE_USERNAME)
SONATYPE_PASSWORD: $(SONATYPE_PASSWORD)
12 changes: 12 additions & 0 deletions development/jenkins_job.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
JOB_GROUP=Maven
JOB_PRODUCT=
JOB_MVN_OPTS=-Xmx512M
JOB_INTEGRATION_SITE=false
JOB_DOCKER_LABELS=jenkins-slave-jdk11-maven
JOB_JDK=JDK17
JOB_MAVEN=Maven 3.8
JOB_REPORTERS=['junit']
JOB_FORKED_PROJECT=true
# Needed for locale-specific org.jacoco.cli.internal.commands.DumpTest
JOB_EXTRA_ENVIRONMENT=[LC_ALL:'C']
JOB_COVERAGE_DISABLED=true
136 changes: 136 additions & 0 deletions development/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<mirrors>
<mirror>
<id>Nexus</id>
<name>Nexus Public Mirror</name>
<url>https://gebit-nexus.local.gebit.de/content/groups/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>

<servers>
<!-- For your own project replace the server ID and environment variables, e.g. xyz-relases and NEXUS_XYZ_USERNAME) -->
<!-- see https://wiki.gebit.de/display/GBLD/Deployment+password+management for details -->
<server>
<id>gebit-releases</id>
<username>${env.NEXUS_GEBIT_BUILD_USERNAME}</username>
<password>${env.NEXUS_GEBIT_BUILD_PASSWORD}</password>
</server>
<server>
<id>gebit-snapshots</id>
<username>${env.NEXUS_GEBIT_BUILD_USERNAME}</username>
<password>${env.NEXUS_GEBIT_BUILD_PASSWORD}</password>
</server>
<server>
<id>gebit-integration</id>
<username>${env.NEXUS_GEBIT_BUILD_USERNAME}</username>
<password>${env.NEXUS_GEBIT_BUILD_PASSWORD}</password>
</server>

<!-- Defines the user to deploy the site. Make sure the jenkins user has the correct key to access the server. -->
<server>
<id>gebit-maven-site</id>
<username>jenkins</username>
</server>
</servers>

<profiles>
<profile>
<id>nexus-profile</id>
<repositories>
<repository>
<id>releases</id>
<url>https://gebit-nexus.local.gebit.de/content/groups/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>integration</id>
<url>https://gebit-nexus.local.gebit.de/content/groups/integration</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>https://gebit-nexus.local.gebit.de/content/groups/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>public</id>
<url>https://gebit-nexus.local.gebit.de/content/repositories/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>public-osgi</id>
<url>https://gebit-nexus.local.gebit.de/content/repositories/public-osgi</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>plugin-integration</id>
<url>https://gebit-nexus.local.gebit.de/content/groups/integration</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>plugin-releases</id>
<url>https://gebit-nexus.local.gebit.de/content/groups/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>plugin-snapshots</id>
<url>https://gebit-nexus.local.gebit.de/content/groups/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>

<activeProfiles>
<activeProfile>nexus-profile</activeProfile>
</activeProfiles>
</settings>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
Contributors:
Marc R. Hoffmann, Jan Wloka - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>jacoco</groupId>
<artifactId>it-report-aggregate-reactors</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>child1-test</artifactId>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>jacoco</groupId>
<artifactId>child1</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;

import org.junit.Test;

public class Example1bTest {

@Test
public void test() {
new Example1b().b();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
Contributors:
Marc R. Hoffmann, Jan Wloka - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>jacoco</groupId>
<artifactId>it-report-aggregate-reactors</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>child1</artifactId>
<packaging>jar</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;

public class Example1a {

public void a() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;

public class Example1b {

public void b() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;

import org.junit.Test;

public class Example1aTest {

@Test
public void test() {
new Example1a().a();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
Contributors:
Marc R. Hoffmann, Jan Wloka - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>jacoco</groupId>
<artifactId>it-report-aggregate-reactors</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>child2</artifactId>
<packaging>jar</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;

public class Example2 {

public void a() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;

import org.junit.Test;

public class Example2Test {

@Test
public void test() {
new Example2().a();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
Contributors:
Marc R. Hoffmann, Jan Wloka - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>jacoco</groupId>
<artifactId>it-report-aggregate-reactors</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>child2</artifactId>
<version>2.0-SNAPSHOT</version>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;

public class Example2 {

public void a() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;

import org.junit.Test;

public class Example2Test {

@Test
public void test() {
new Example2().a();
}

}
50 changes: 50 additions & 0 deletions jacoco-maven-plugin.test/it/it-report-aggregate-reactors/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
Contributors:
Marc R. Hoffmann, Jan Wloka - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>jacoco</groupId>
<artifactId>setup-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>it-report-aggregate-reactors</artifactId>
<packaging>pom</packaging>

<modules>
<module>child1</module>
<module>child1-test</module>
<module>child2</module>
<module>child2v2</module>
<module>report</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0
SPDX-License-Identifier: EPL-2.0
Contributors:
Marc R. Hoffmann, Jan Wloka - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>jacoco</groupId>
<artifactId>it-report-aggregate-reactors</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>report</artifactId>
<name>Aggregate Report</name>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate-all</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package packagereport;

import org.junit.Test;

public class ReportTest {

@Test
public void test() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
import org.codehaus.plexus.util.*;
import java.util.regex.*;

String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );

if ( !Pattern.compile( "Loading execution data file \\S*child1.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child1 was not loaded." );
}

if ( !Pattern.compile( "Loading execution data file \\S*child1-test.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child1-test was not loaded." );
}

if ( !new File( basedir, "child2/target/jacoco.exec" ).isFile()) {
throw new RuntimeException( "No execution data in child2." );
}
if ( !Pattern.compile( "Loading execution data file \\S*child2.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child2 was not loaded." );
}
if ( !Pattern.compile( "Loading execution data file \\S*child2v2.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child2v2 was not loaded." );
}

if ( !Pattern.compile( "Loading execution data file \\S*report.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from report was not loaded." );
}

File reportChild1 = new File( basedir, "report/target/site/jacoco-aggregate/child1/index.html" );
if ( !reportChild1.isFile() ) {
throw new RuntimeException( "Report for child1 was not created." );
}

File reportChild1test = new File( basedir, "report/target/site/jacoco-aggregate/child1-test/index.html" );
if ( !reportChild1test.isFile() ) {
throw new RuntimeException( "Report for child1-test was not created." );
}

File reportChild2 = new File( basedir, "report/target/site/jacoco-aggregate/child2/index.html" );
if ( !reportChild2.isFile() ) {
throw new RuntimeException( "Report for child2 was not created." );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* John Oliver, Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package org.jacoco.maven;

import java.util.ArrayList;
import java.util.List;

import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.StringUtils;

/**
* <p>
* Creates a structured code coverage report (HTML, XML, and CSV) from multiple
* projects within reactor. The report is created from all modules this project
* depends on, and optionally this project itself. From those projects class and
* source files as well as JaCoCo execution data files will be collected. In
* addition execution data is collected from the project itself. This also
* allows to create coverage reports when tests are in separate projects than
* the code under test, for example in case of integration tests.
* </p>
*
* <p>
* Using the dependency scope allows to distinguish projects which contribute
* execution data but should not become part of the report:
* </p>
*
* <ul>
* <li><code>compile</code>, <code>runtime</code>, <code>provided</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>
*
* @since 0.8.13
*/
@Mojo(name = "report-aggregate-all", threadSafe = true, aggregator = true)
public class ReportAggregateAllMojo extends ReportAggregateMojo {

@Override
protected List<MavenProject> findDependencies(final String... scopes) {
final List<MavenProject> result = reactorProjects;
if (!includeCurrentProject) {
result.remove(project);
}

// need to exclude pom projects
final List<MavenProject> nonPomProjects = new ArrayList<>();
for (final MavenProject mavenProject : result) {
if (!StringUtils.equals("pom", mavenProject.getPackaging())) {
nonPomProjects.add(mavenProject);
}
}
return nonPomProjects;
}
}
Original file line number Diff line number Diff line change
@@ -89,13 +89,13 @@ public class ReportAggregateMojo extends AbstractReportMojo {
* @since 0.8.9
*/
@Parameter(defaultValue = "false")
private boolean includeCurrentProject;
protected boolean includeCurrentProject;

/**
* The projects in the reactor.
*/
@Parameter(property = "reactorProjects", readonly = true)
private List<MavenProject> reactorProjects;
protected List<MavenProject> reactorProjects;

@Override
boolean canGenerateReportRegardingDataFiles() {
@@ -179,8 +179,8 @@ public String getName(final Locale locale) {
return "JaCoCo Aggregate";
}

private List<MavenProject> findDependencies(final String... scopes) {
final List<MavenProject> result = new ArrayList<MavenProject>();
protected List<MavenProject> findDependencies(final String... scopes) {
final List<MavenProject> result = new ArrayList<>();
final List<String> scopeList = Arrays.asList(scopes);
for (final Object dependencyObject : project.getDependencies()) {
final Dependency dependency = (Dependency) dependencyObject;
@@ -221,5 +221,4 @@ private MavenProject findProjectFromReactor(final Dependency d) {
}
return null;
}

}
13 changes: 11 additions & 2 deletions org.jacoco.build/pom.xml
Original file line number Diff line number Diff line change
@@ -18,6 +18,12 @@
<version>0.8.13-SNAPSHOT</version>
<packaging>pom</packaging>

<parent>
<groupId>org.jacoco</groupId>
<artifactId>root</artifactId>
<version>0.8.13-SNAPSHOT</version>
</parent>

<name>JaCoCo</name>
<description>JaCoCo - Java Code Coverage Library</description>
<url>http://jacoco.org</url>
@@ -337,7 +343,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>2.0.0</version>
<version>3.7.0</version>
<configuration>
<streamLogsOnFailures>true</streamLogsOnFailures>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -519,7 +528,7 @@
<version>17</version>
</requireJavaVersion>
<requireMavenVersion>
<version>3.9.9</version>
<version>3.6.3</version>
</requireMavenVersion>
<requireNoRepositories>
<message>The rules for repo1.maven.org are that pom.xml files should not include repository definitions.</message>
2 changes: 1 addition & 1 deletion org.jacoco.core.test.validation.scala/pom.xml
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.4.0</version>
<version>4.5.6</version>
<executions>
<execution>
<id>compile</id>
5 changes: 5 additions & 0 deletions org.jacoco.examples.test/pom.xml
Original file line number Diff line number Diff line change
@@ -38,6 +38,11 @@
<groupId>${project.groupId}</groupId>
<artifactId>org.jacoco.agent.rt</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
42 changes: 42 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -10,4 +10,46 @@
<module>org.jacoco.build</module>
</modules>

<properties>
<!-- GEBIT: versions to be used for gebit-build support -->
<version.tiles>2.8-gebit38</version.tiles>
<version.gebit-build-extension>1.2.2</version.gebit-build-extension>
<version.gebit-forked>1.0.2</version.gebit-forked>
<tiles.applyBefore>org.jacoco:root</tiles.applyBefore>
<tiles.mergeTarget>${tiles.applyBefore}</tiles.mergeTarget>
<version.build>3.9.1</version.build>
<version.java>17</version.java>
<!-- GEBIT: end -->
</properties>

<build>
<plugins>
<!-- GEBIT: Tiles -->
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>${version.tiles}</version>
<extensions>true</extensions>
<configuration>
<applyBefore>${tiles.applyBefore}</applyBefore>
<mergeTarget>${tiles.mergeTarget}</mergeTarget>
<tiles>
<tile>de.gebit.build.forked.tile:forked-base:${version.gebit-forked}</tile>
</tiles>
</configuration>
</plugin>
<!-- GEBIT: end -->
</plugins>

<!-- GEBIT: Extensions -->
<extensions>
<extension>
<groupId>de.gebit.build.maven</groupId>
<artifactId>gebit-build-extension</artifactId>
<version>${version.gebit-build-extension}</version>
</extension>
</extensions>
<!-- GEBIT: end -->

</build>
</project>