Is it possible to extend the SonarRunner class that exist in the following package: org.gradle.sonar.runner.tasks.SonarRunner?. If so, would it be possible to do something as the following: TempPlugin.groovy
import org.gradle.api.Plugin
import org.gradle.api.Project
class TempPlugin implements Plugin<Project> {
void apply(Project project) {
project.task('sonarRunnerHelper', type: SonarRunnerHelper,
description: 'Analyzes a project and its subprojects with Sonar Runner')
}
SonarRunnerHelper.groovy
import java.util.HashMap;
import java.util.Map;
import org.gradle.sonar.runner.tasks.SonarRunner
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.Input
/**
* Sonar Runner Helper
*/
class SonarRunnerHelper extends SonarRunner {
public SonarRunnerHelper() {
super();
}
@Input
Map<String, Object> tempSonarProperties = getSonarProperties();
/**
* Analyzes a project and its subprojects with Sonar Runner
*
*
*/
@Override
public void run() {
if (!tempSonarProperties.isEmpty()) {
for(Map.Entry<String, Object> entry : tempSonarProperties.entrySet()) {
super.setProperty(entry.getKey(), entry.getValue());
}
}
}
}
My plan is to use the above code in a standalone project by definining dependencies in a buildscript closure while defining my repositories and dependencies there.