Gradle Sonar plugin does not support Groovy properly


(Mike Cornell) #1

The gradle sonar plugin does not properly support groovy projects. It is missing some of the Sensors that are applied by the Sonar Groovy Plugin: https://svn.codehaus.org/sonar-plugins/tags/sonar-groovy-plugin-0.5/src/main/java/org/sonar/plugins/groovy/GroovyPlugin.java

Here is output from the project running Sonar and Gradle. https://gist.github.com/1772877

The source for the project is here: https://github.com/mcornell/dnd-tdd-groovy


(Peter Niederwieser) #2

Can you explain what you mean by “it is missing some of the Sensors”? How would those sensors get applied when using Maven? Can the Sonar Groovy plugin be configured in the Sonar web app?


(Mike Cornell) #3

Hmmm, apparently my response never took.

The Sonar Groovy plugin is configured in the web app, but the projects are configured identically.

The gist shows that the GroovyCoberturaSensor is triggered for the maven run. However it is not triggered in Gradle. Both jobs are supposed to import the Cobertura report from the Gradle Cobertura run. However, the Gradle version does not perform the import.

Similarly, CPD being turned on for Gradle actually crashes the build. I have to turn that off in Gradle, but Maven can handle it.


(Peter Niederwieser) #4

Sounds like those Sonar plugins somehow depend on Maven. I’m not aware of anything that the Gradle Sonar plugin can do about this. I suggest to ping the plugin authors and ask them to add support for Gradle.


(excentric) #5

The GroovyCoberturaSensor as it stands right now will only be triggered when the following condition is met:

project.getAnalysisType().isDynamic(true) && Groovy.KEY.equals(project.getLanguageKey());

check these properties are set correctly for your project.