i am trying to get jacoco working, so it reports me my code coverage of my integration tests. Currently i have this setup
parent.pom
-- module1
-- module2
-- module3
-- module4
-- report
module 1 to 3 contains my source code, while module 4 contains a client, which runs the integration tests.
parent.pom includes the jacoco-plugin:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<execution>
<id>prepare-unit-test-agent</id>
<phase>generate-test-sources</phase>
<configuration>
<append>true</append>
<destFile>${project.build.directory}/jacoco.exec</destFile>
</configuration>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>prepare-it-test-agent</id>
<phase>pre-integration-test </phase>
<configuration>
<propertyName>failsafeArgLine</propertyName>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
<append>true</append>
</configuration>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
<goals>
<goal>report-integration</goal>
</goals>
</execution>
</executions>
</plugin>`
report pom:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>it-report</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
<configuration>
<dataFileIncludes>
<dataFileInclude>**/jacoco.exec</dataFileInclude>
<dataFileInclude>**/jacoco-it.exec</dataFileInclude>
</dataFileIncludes>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-overall</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
in my report module, all other modules are imported as dependencie with scope = compile.
Now, the generated Coverage, only shows that the tests cover takes place in module 1. Since the logic is something like this: Module 3 = Interface Module 2 = Implementation of the Interfaces Module 1 = entities
it is strange that the Code of Module 2 and 3 are not shows as covered. All the tests call methods from Module 3.
Just for side info: Source is in Java, Tests are in groovy