# sonarRunner test dependency

**URL:** <https://discuss.gradle.org/t/sonarrunner-test-dependency/1876>\
**Category:** Old Forum Archive\
**Created:** [April 12, 2013, 1:38pm UTC](https://discuss.gradle.org/t/sonarrunner-test-dependency/1876 "2013-04-12T13:38:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_von\_Zitzew](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Alexander\_von\_Zitzew](https://discuss.gradle.org/u/Alexander_von_Zitzew)\
**Post date:** [April 12, 2013, 1:38pm UTC](https://discuss.gradle.org/t/sonarrunner-test-dependency/1876/1 "2013-04-12T13:38:00Z")

</div>

I use sonarRunner in my gradle build script and it works very well unless a unit test fails. In that case gradle will not execute the sonarRunner taks (even with the --continue option), because it implicitly depends on test. I would say that this implicit dependency should not be there and that users of the plugin need to be aware that the tests have run before. Or am I missing something?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [April 12, 2013, 1:41pm UTC](https://discuss.gradle.org/t/sonarrunner-test-dependency/1876/2 "2013-04-12T13:41:00Z")

</div>

Good point. Previously, people complained that ‘gradle sonarAnalyze’ does _not_ run ‘compile’ and ‘test’, but the situation you describe is the bigger evil. We may have to remove the task dependency, or change it into one of the new task relationships introduced in Gradle 1.6+. Meanwhile, you can get rid of the unwanted dependency with ‘tasks.sonarRunner.dependsOn = []’.

---

<div class="post-metadata">

**Author:** ![Matthew\_Rusinak](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@Matthew\_Rusinak](https://discuss.gradle.org/u/Matthew_Rusinak)\
**Post date:** [January 6, 2014, 3:58pm UTC](https://discuss.gradle.org/t/sonarrunner-test-dependency/1876/3 "2014-01-06T15:58:00Z")

</div>

Ran into a related problem (a 3rd party library collected the coverage metrics, which causes executing the tests and uploading sonar to be disjoint), thanks to both of you for the quick fix.

I went a small step further and switched it to use the mustRanAfter construct.

```gradle
tasks.sonarRunner.dependsOn = []
tasks.sonarRunner.mustRunAfter(test)

```

---

<div class="post-metadata">

**Author:** ![Lars\_Sadau](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@Lars\_Sadau](https://discuss.gradle.org/u/Lars_Sadau)\
**Post date:** [November 26, 2014, 12:02pm UTC](https://discuss.gradle.org/t/sonarrunner-test-dependency/1876/4 "2014-11-26T12:02:00Z")

</div>

The current gradle (version 2.2.1) still has this “feature”. Is there any plan to change it?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 27, 2014, 12:19pm UTC](https://discuss.gradle.org/t/sonarrunner-test-dependency/1876/5 "2014-11-27T12:19:00Z")

</div>

It’s an open issue (see GRADLE-2749).
