Compile only changed modules when running sonar gradle task

I am using sonar gradle task on spring multimodule project

My project consists of many subprojects and as I understand, the sonar plugin adds the sonar task to root project.
Therefore even if I make changes to just one module, the task scans and compiles all subprojects.
The task runs more than 10 minutes and I am looking for ways to reduce the time.

Is there a way to run the sonar task on changed modules only?
A way of targeting modules might also be helpful

Hey there.

You can’t get away with not scanning all projects (although if you’re using Pull Request analysis in Developer Edition, a cache will get used if you’ve scanned the target branch).

You can however choose when you compile. If you’re performing some sort of incremental build and all the bytecode is available by the time the scanner kicks off, this might help:

1 Like