How can I run the sonarRunner task on only a subproject?


(benajmin_patterson) #1

How can I run the sonarRunner task on only a subproject?

I’ve got my sonarRunner configuration set in a parent project, and a subproject which needs some custom parameters (language). Whenever I ask for the sonarRunner task, it analyzes from root. This happens whether I’m in the subproject directory or if I’m at root and pass in the project with the -p switch. It builds the project I need first, which is good, but then looks like it analyzes the whole tree.

Here’s my config:

parent/root–relevant sonar stuff: apply plugin: “sonar-runner”

sonarRunner {

sonarProperties {

property “sonar.host.url”, “http://blah:9000

property “sonar.jdbc.url”, “jdbc:mysql://blah/sonar”

property “sonar.jdbc.driverClassName”, “com.mysql.jdbc.Driver”

property “sonar.jdbc.username”, “foo”

property “sonar.jdbc.password”, “bar”

}

}

…and in the subproject (which I’m storing in the parent build.gradle file right now):

project(":blah:blah2") {

sonarRunner {

sonarProperties {

property “sonar.language”, “py”

}

}

}

I have also tried taking the subproject config and putting it in that directory’s build.gradle file, like this:

sonarProperties {

property “sonar.language”, “py”

}

But, I see the same issue.

Any suggestions?