I have a gradle script that uses Sonarqube plugin (org.sonarqube). If I let the publish task depends on it, it works fine.
The problem is to run sonarqube only if a condition is true. So I tried (as described in gradle documentation) all of these three statements:
sonarqube.enabled (false)
sonarqube.enabled=false
sonarqube.onlyIf { false }
Each results in an error, here the one I got trying the first statement
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Eclipse\workspace3.6\at.mic.hermes\build.gradle' line: 208
* What went wrong:
A problem occurred evaluating root project 'at.mic.hermes'.
> Could not find method enabled() for arguments [false] on org.sonarqube.gradle.SonarQubeExtension_Decorated@412196.
To be sure to have not typo in the code I tried all statements with the test task, e.g.
test.enabled(false)
and this results (as expeted) in
:test SKIPPED
Any ideas what I made wrong / what must be changed? Thx in advance!
Frank