I was tasked with splitting up a spring boot application to have multiple modules to look something like this:
- root
- app
- build.gradle
- rest
- build.gradle
- service
- build.gradle
- dao
- build.gradle
- model
- build.gradle
- build.gradle
- settings.gradle
- app
Note: there is no code folder in the root of the project. Each module has its own src
root
Before splitting the code into modules, the gradle-clover-plugin was showing that we had 95% code coverage, but due to the way that the tests are now organized, the plugin is not able to see that some of the code is being tested in other modules
For instance some of the service
Class methods are being tested from the rest
module while testing the controllers.
Looking thru the documentation for the plugin (https://github.com/bmuschko/gradle-clover-plugin/blob/master/README.md), they mention specifying additionalSourceSets
and additionalTestSourceSets
in the example
towards the bottom of the page, but it's not clear to me how to use those in my project
I added the following block from the example to my root build.gradle
:
additionalSourceSet {
srcDirs = sourceSets.generatedCode.java.srcDirs
classesDir = sourceSets.generatedCode.java.outputDir
}
additionalTestSourceSet {
srcDirs = sourceSets.integrationTest.java.srcDirs
classesDir = sourceSets.integrationTest.java.outputDir
}
but was getting the following exception: Could not get unknown property 'generatedCode' for SourceSet container of type org.gradle.api.internal.tasks.DefaultSourceSetContainer.
I then tried swapping out generatedCode and integrationTest with the names of my modules in the root build.gradle
but was getting the same exception
Finally I tried specifying those properties in the build.gradle for the module, but was getting the following exception: Could not find method additionalSourceSets() for arguments on object of type com.bmuschko.gradle.clover.CloverPluginConvention
Is it indeed possible to specify another modules' sources for the plugin to consider when generating the code coverage report for a different module?