Setting sonar.gradle.skipCompile through a Gradle property would be nice

only allows you to set it as a system property.
Would be nice if it was also possible to set it as a gradle property since you could then add it to the gradle.properties file once your build is conforming.

Hey there.

I think we’re heading in the right direction with this: [SONARGRADL-134] - Jira

I have set system property to skip compilation.
Now I run gradle build task and after it sonar task. So everything is compile in front and sonar picks up bytecode and analyses it.

As a side-effect I’m getting following Gradle warnings for subprojects when running sonar task:

Resolution of the configuration :projectName:compileClasspath was attempted from a context different than the project context. Have a look at the documentation to understand why this is a problem and how it can be resolved. This behavior has been deprecated. This will fail with an error in Gradle 9.0. For more information, please refer to https://docs.gradle.org/8.5/userguide/viewing_debugging_dependencies.html#sub:resolving-unsafe-configuration-resolution-errors in the Gradle documentation.

Is anyone else also getting this warning because of this skipCompile configuration or is this something project specific that I should resolve?

Hey @rivancic

I anticipate we’ll clean this up as a part of this ticket

2 Likes

@Colin thank you very much for the prompt response.

From the performance PoV I was actually expecting a slight improvement as Gradle won’t need to check if the compile task was already executed or not, while it is the opposite. Working on a project with hundred something subprojects.

ATM it takes more time to print out warning logs of this resolution warnings to the console for each subproject with skipCompile set to true (~30s) then if

we don’t explicitly set skipCompile option and sona plugin relies on the compile task and to figure for all that they are up-to-date takes all-together (~7s) sec.

Will wait that those warnings are resolved to enable the flag again.

The new version for the scanner for Gradle is out:
https://plugins.gradle.org/plugin/org.sonarqube

You can try to test it now. The official announcement will happen later. The main idea is that you build and test it the way how you need it and then run the sonar command.

Note: You don’t need to set the skipCompile property anymore! But, please, make sure that you’ve run build and test tasks when executing the sonar task.

Best,
Margarita