Gradle: SonarQube Runner with Jacoco and Multi-Project

844 views
Skip to first unread message

David Peterka

unread,
Mar 30, 2016, 10:26:50 AM3/30/16
to SonarQube
Hello,

I'm trying to figure out how to make sonarqube have a dependency on Jacoco jacocoTestReport so the following would execute both sonar and jacoco:

gradle clean test sonarqube

I've tried a few combinations but since sonarqube is applied to the root project and jacocoTestReport seems the dependency has a hard time finding the tasks or enters a loop depending on where I place the dependency.  I would love to know if anyone has solved this.

----

Here's an example in shorthand of what I am after:

in root build.gradle I just have something like:

apply plugin 'org.sonarqube'
project.tasks["sonarqube"].dependsOn jacocoTestReport

which returns

* What went wrong:
A problem occurred evaluating root project 'my-project'.
> Could not find property 'jacocoTestReport' on root project 'my-project`.


If I try to say refer to the subtasks from subprojects it doesn't come up seems the array is empty for built in tasks.

project.tasks["sonarqube"].dependsOn subprojects.tasks["jacocoTestReport"]

Could not find property 'jacocoTestReport' on task set


Julien HENRY

unread,
Mar 31, 2016, 3:45:49 AM3/31/16
to SonarQube
Hi David,

There is already a dependency between sonarqube and test task (for Java projects). And as far as I know the JaCoCo plugin will automatically be executed during tests. So in theory you don't have anything to do.
See for example:

++

Julien
Reply all
Reply to author
Forward
0 new messages