0

USE CASE

I have developed a spring-shell based maven module apim-library.

And then I developed an application apim-cli which has apim-library as a dependency and only the Application class with main.

I am writing Unit Tests using JUnit5, Mockito, etc in the application src/test/java/ but I want tests the classes into apim-library.

WHAT AM I USING

  1. VSCode
  2. Java 17
  3. Spring Boot 3.1.3
  4. Spring Shell 3.1.3
  5. Jacoco 0.8.10
  6. Maven 3.9.4

WHAT HAPPENS

The library and the application are in the same workspace. I ran mvn clean install in the library project and it was successfully compiled and installed. I set up the application's pom.xml to generate a report with jacoco:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>${jacoco-maven-plugin.version}</version>
    <executions>
        <execution>
            <id>initialize</id>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
        <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
                <goal>report</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <includes>
            <include>com/apim/**</include>
        </includes>
    </configuration>
</plugin>

When I run the mvn clean test and mvn jacoco:report commands, only the Application class report is generated.

How should I do to have a Jacoco report with the coverage of the external maven module classes?

2
  • does specifying <inclNoLocationClasses>true</inclNoLocationClasses> in plugin configuration help? Commented Sep 23, 2023 at 11:57
  • Unfortunately it doesn't work Commented Sep 23, 2023 at 15:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.