Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JaCoCo for Code Coverage Reports in Pass Support #142

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
94 changes: 94 additions & 0 deletions jacoco-aggregate-report/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>org.eclipse.pass</groupId>
<artifactId>pass-support</artifactId>
<version>1.14.0-SNAPSHOT</version>
</parent>

<artifactId>jacoco-aggregate-report</artifactId>

<properties>
</properties>

<dependencies>
<dependency>
<groupId>org.eclipse.pass</groupId>
<artifactId>pass-data-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass.deposit</groupId>
<artifactId>deposit-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass.deposit</groupId>
<artifactId>deposit-cri</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass.deposit</groupId>
<artifactId>deposit-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass.deposit</groupId>
<artifactId>deposit-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass</groupId>
<artifactId>pass-grant-loader</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass</groupId>
<artifactId>pass-journal-loader-nih</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass</groupId>
<artifactId>nihms-data-harvest</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass</groupId>
<artifactId>nihms-data-transform-load</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass</groupId>
<artifactId>nihms-etl-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.pass</groupId>
<artifactId>pass-notification-service</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the version element here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the changes, check your commit.

<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
1 change: 1 addition & 0 deletions pass-data-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
</plugin>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove these line feeds in the children pom.xml file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the changes, check your commit.

</plugins>
</build>
</project>
1 change: 1 addition & 0 deletions pass-journal-loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
<artifactId>maven-help-plugin</artifactId>
<version>3.4.0</version>
</plugin>

</plugins>

</build>
Expand Down
1 change: 1 addition & 0 deletions pass-nihms-loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
<artifactId>maven-help-plugin</artifactId>
<version>3.4.0</version>
</plugin>

</plugins>
</build>

Expand Down
2 changes: 2 additions & 0 deletions pass-notification-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
</plugin>


</plugins>
</build>
</project>
31 changes: 29 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@

<modules>
<module>pass-data-client</module>
<module>pass-journal-loader</module>
<module>pass-deposit-services</module>
<module>pass-grant-loader</module>
<module>pass-journal-loader</module>
<module>pass-nihms-loader</module>
<module>pass-notification-service</module>
<module>pass-deposit-services</module>
<module>jacoco-aggregate-report</module>
</modules>

<scm>
Expand All @@ -72,6 +73,7 @@

<properties>
<maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
</properties>

<dependencyManagement>
Expand All @@ -91,7 +93,31 @@
</repositories>

<build>
<pluginManagement>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this pom looks like it requires the plugin declaration in the plugins element too (line 109), you can remove the pluginManagement element and put the <version>${jacoco-maven-plugin.version}</version> below in the plugins section.

Copy link
Contributor Author

@tsande16 tsande16 Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this 4 different ways, and here were the results:

With only the plugin without the agent in the root POM

image

<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <version>${jacoco-maven-plugin.version}</version>
</plugin>

With only the plugin in the pluginManagement tag in the root POM

image

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.jacoco</groupId>
      <artifactId>jacoco-maven-plugin</artifactId>
      <version>${jacoco-maven-plugin.version}</version>
    </plugin>
  </plugins>
</pluginManagement>

Plugin with agent only in the root POM

image

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

With pluginManagement and the agent in plugin tags in the root POM

image

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
      </plugin>
    </plugins>
  </pluginManagement>

  <plugins>
    <plugin>
      <groupId>org.jacoco</groupId>
      <artifactId>jacoco-maven-plugin</artifactId>
      <executions>
        <execution>
          <id>prepare-agent</id>
          <goals>
            <goal>prepare-agent</goal>
          </goals>
        </execution>
      </executions>
    </plugin>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks the original setup with only the agent in the root POM is the way to go?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as we discussed, I'd say go with this config: Plugin with agent only in the root POM. Also, I don't see the changes, check your commit.

<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>

<plugins>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand All @@ -107,6 +133,7 @@
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
</plugin>

</plugins>
</build>
</project>
Loading