I want to skip sonarRunner if no code change happened.
gradlew clean build artifactoryPublish sonarRunner
Below does not work
sonarRunner {
onlyIf { javaCompile.didWork }
}
I want to skip sonarRunner if no code change happened.
gradlew clean build artifactoryPublish sonarRunner
Below does not work
sonarRunner {
onlyIf { javaCompile.didWork }
}
It’s not quite as straightforward. Try something like:
tasks.sonarRunner {
onlyIf { projects.any { tasks.withType(JavaCompile).any { it.didWork } } }
}
Hi Peter,
We tried to skip sonarRunner with below configuration, but behavior is not very consistent.
tasks.sonarRunner {
println project.name + "----" + tasks.withType(JavaCompile).any { it.didWork }
onlyIf {
tasks.withType(JavaCompile).any { it.didWork } }
}
It works if we run
%> gradle sonarRunner But if we run and tasks.withType(JavaCompile).any { it.didWork } evaluates to false %. gradle build sonarRunner
it doesn’t skip
Let me know where we would be wrong
You have to do the ‘println’ inside ‘onlyIf’. Otherwise, it will always print ‘false’, because none of the tasks has run yet.