.setTransitive(false)
.setDescription("The SonarRunner configuration to use to run analysis")
.getIncoming()
.beforeResolve(new Action<ResolvableDependencies>() {
public void execute(ResolvableDependencies resolvableDependencies) {
DependencySet dependencies = resolvableDependencies.getDependencies();
if (dependencies.isEmpty()) {
String toolVersion = rootExtension.getToolVersion();
DependencyHandler dependencyHandler = project.getDependencies();
Dependency dependency = dependencyHandler.create("org.codehaus.sonar.runner:sonar-runner-dist:" + toolVersion);
configuration.getDependencies().add(dependency);
}