I need to execute the Gradle cobertura plugin twice with different settings for one execution of the sonarqube plugin. The reason for needing to execute twice is that the coverage analysis for Groovy and Java need to be in separate report files. Java and Groovy have separate properties for Sonar to say where the report file is for the respective language (sonar.cobertura.reportPath
and sonar.groovy.cobertura.reportPath
). The reason I cannot leave the analysis in the same file is because the upload to Sonar fails complaining about duplicate metrics. Which I imagine is because of the same file getting read once by the Java plugin and once by the Groovy plugin.
Therefore, from what I can see, I need a coverageGroovy.xml
and a coverageJava.xml
. So far, I have not found a way to do this in Gradle.
Any ideas are appreciated.
(One idea I had was to use JaCoCo for only the Java tests, but I did not see a way to limit JaCoCo to only the Java files.)