I am getting 0% code coverage with java 17 options that I need to use to use reflection

I am using java 17 options shown in the below pom.xml .

<?xml version="1.0" encoding="UTF-8"?> 4.0.0 2.43-SNAPSHOT jar test
<url>http://maven.apache.org</url>
<scm>
    <connection>someurl</connection>
    <url>https://bitbucket.com</url>
    <tag>HEAD</tag>
</scm>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <artifactory.repo>https://artifactory-fr.com</artifactory.repo>
    <junit.version>4.13.2</junit.version>

    <reactor.core.version>3.3.10.RELEASE</reactor.core.version>
    <java.17.options>
        --add-opens=java.base/java.io=ALL-UNNAMED
        --add-opens=java.base/java.lang=ALL-UNNAMED
        --add-opens=java.base/java.math=ALL-UNNAMED
        --add-opens=java.base/java.util=ALL-UNNAMED
        --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
        --add-opens=java.base/java.net=ALL-UNNAMED
        --add-opens=java.base/java.text=ALL-UNNAMED
        --add-opens=java.sql/java.sql=ALL-UNNAMED
    </java.17.options>
</properties>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <version>${spring-boot-starter}</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>dev.morphia.morphia</groupId>
        <artifactId>morphia-core</artifactId>
        <version>${morphia.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.mongodb</groupId>
                <artifactId>mongodb-driver-sync</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.mongodb</groupId>
                <artifactId>mongodb-driver-legacy</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongodb-driver-sync</artifactId>
        <version>4.5.1</version>
    </dependency>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongodb-driver-legacy</artifactId>
        <version>4.5.1</version>
    </dependency>
    <dependency>
        <groupId>de.flapdoodle.embed</groupId>
        <artifactId>de.flapdoodle.embed.mongo</artifactId>
        <version>${embedded.mongo.version}</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-compress</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-compress</artifactId>
        <version>1.21</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${spring.test.version}</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>3.12.4</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commons.io.version}</version>
    </dependency>
    <dependency>
        <groupId>io.projectreactor</groupId>
        <artifactId>reactor-core</artifactId>
        <version>${reactor.core.version}</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>central</id>

        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>artifactory-libs</id>
        <name>libs</name>
        <url>${artifactory.repo}/ignite-libs</url>
    </repository>
</repositories>
<distributionManagement>
    <repository>
        <id>artifactory-release</id>
        <name>libs-release</name>
        <url>${artifactory.repo}/ignite-libs-release</url>
    </repository>
    <snapshotRepository>
        <uniqueVersion>true</uniqueVersion>
        <id>artifactory-snapshot</id>
        <name>libs-snapshot</name>
        <url>${artifactory.repo}/libs-snapshot</url>
    </snapshotRepository>
</distributionManagement>

<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <url>${artifactory.repo}/dependencies</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>artifactory-libs</id>
        <url>${artifactory.repo}/libs</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>


<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerArgs>
                        <arg>--add-opens=java.base/java.io=ALL-UNNAMED</arg>
                        <arg>--add-opens=java.base/java.lang=ALL-UNNAMED</arg>
                        <arg>--add-opens=java.base/java.math=ALL-UNNAMED</arg>
                        <arg>--add-opens=java.base/java.util=ALL-UNNAMED</arg>
                        <arg>--add-opens=java.base/java.util.concurrent=ALL-UNNAMED</arg>
                        <arg>--add-opens=java.base/java.net=ALL-UNNAMED</arg>
                        <arg>--add-opens=java.base/java.text=ALL-UNNAMED</arg>
                        <arg>--add-opens=java.sql/java.sql=ALL-UNNAMED</arg>
                    </compilerArgs>
                    <source>17</source>
                    <target>17</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <additionalparam>-Xdoclint:none</additionalparam>
                    <arguments>-Dmaven.javadoc.skip=false</arguments>
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>${basedir}</directory>
                        <includes>
                            <include>**/jar/</include>
                        </includes>
                        <followSymlinks>false</followSymlinks>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <shadedArtifactAttached>true</shadedArtifactAttached>
                        <minimizeJar>false</minimizeJar>
                        <artifactSet />
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven.surefire.version}</version>
            <configuration>
                <!-- Sets the VM argument line used when unit tests are run. -->
                <argLine>${surefireArgLine}</argLine>
                <threadCount>1</threadCount>
                <forkMode>pertest</forkMode>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.8</version>
            <configuration>

            </configuration>
            <executions>
                <!-- Prepares the property pointing to the JaCoCo runtime agent which

is passed as VM argument when Maven the Surefire plugin is executed. →

pre-unit-test

prepare-agent



${jacoco.ut.execution.data.file}

java.17.options
surefireArgline




post-unit-test
test

report



${jacoco.ut.execution.data.file}

${project.reporting.outputDirectory}/jacocout






org.sonarsource.scanner.maven
sonar-maven-plugin
3.4.0.905



Hi,

Welcome to the community!

Please share your full analysis log.

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

16:13:11 Tests run: 110, Failures: 0, Errors: 0, Skipped: 0 16:13:11 16:13:11 [INFO] 16:13:11 [INFO] — jacoco-maven-plugin:0.8.8:report (post-unit-test) @ -dao — 16:13:11 [INFO**] Skipping JaCoCo execution due to missing execution data file.** 16:13:11 [INFO] 16:13:11 [INFO] — maven-jar-plugin:2.4:jar (default-jar) -------------

From the above logs we can see that jacoco execution is skipped

This is happening when I am using java.17.options as mentioned in the above pom

Hi,

I asked for your full analysis log, but the snippet you’ve provided is from before analysis. Nonetheless, it’s all we need here since it shows - as you said - that JaCoCo execution is skipped, and that’s outside the scope of analysis.

Sorry, but it’s not something we can help you with here.

 
Ann