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
- VSCode
- Java 17
- Spring Boot 3.1.3
- Spring Shell 3.1.3
- Jacoco 0.8.10
- 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?
<inclNoLocationClasses>true</inclNoLocationClasses>in plugin configuration help?