How to report jacoco sources / classes are outside of module

Module A is a separate module containing all integration tests. Maven-Jacoco-Sonar works great if sources and tests are located in the same module.

Since module A is a completely different module, we won't be able to easily generate jacoco reports. As jacoco cannot find sources in module A for measuring report coverage. The source files are all in different modules. To generate a report, jacoco must have class files and source files. We have to link them to module A accordingly, creating a jacoco report so that jacoco-it.exec can be easily pulled onto Sonar to display coverage analysis.

Currently in this case, Classes being run under the jacoco agent but no source / class files available

Please help me if anyone has a solution on how to achieve the above functionality. It would be so helpful to me.

+3


source to share


1 answer


try adding the following as your main src

 def debugTree = [fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter),
                 fileTree(dir: "${project(":your_module_name").projectDir}/build/intermediates/classes/debug", excludes: fileFilter)]
 def mainsrc = [fileTree(dir:"${project(":your_module_name").projectDir}/src/main/java"),
                     fileTree(dir:"${project.projectDir}/src/main/java")]
 sourceDirectories = files(mainsrc)
 classDirectories = files(debugTree)

      



This will include the external submodule files to be used when generating the jacoco report.

0


source







All Articles