Currently, when running tests in Quarkus (./mvnw test
) the JacoCo report is generated. However, when opening target/jacoco-report/index.html
, the h1
tag is filled with the first test class that is run instead of the name of the project.
artifactId
is not used?PS: in jacoco.xml
it's <report name=""></report>
In Quarkus ecosystem there are two ways to measure code coverage with JaCoCo.
According to the documentation
This Quarkus extension takes care of everything that would usually be done via the JaCoCo Maven plugin ...
However it's true it maybe configures JaCoCo a slightly different way then the jacoco-maven-plugin
does.
To customize root node of the report just add this extension to pom.xml
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jacoco</artifactId>
<scope>test</scope>
</dependency>
and set this configuration property in application.properites
quarkus.jacoco.title=My Awesome Project's coverage report
More configuration options are available here.
jacoco-maven-plugin
This Maven plugin has a configuration property title
to customize the root name of the report.
According to the goal's documentation
Default value is : ${project.name}
And ${project.name}
also has default value: ${project.artifactId}
.
So, to customize (override) the root name of the report using jacoco-maven-plugin
pom.xml
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.acme</groupId>
<artifactId>code-with-quarkus</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>My Awesome Quarkus App</name>
</project>
or
jacoco-maven-plugin
's report goal<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<exclClassLoaders>*QuarkusClassLoader</exclClassLoaders>
<append>true</append>
</configuration>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<phase>test</phase>
<configuration>
<title>Here comes an overridden title</title>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>