# How to override gradleApi() transitive dependencies?

**URL:** <https://discuss.gradle.org/t/how-to-override-gradleapi-transitive-dependencies/10185>\
**Category:** Help/Discuss\
**Created:** [June 19, 2015, 12:59pm UTC](https://discuss.gradle.org/t/how-to-override-gradleapi-transitive-dependencies/10185 "2015-06-19T12:59:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomek\_Przybysz](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@Tomek\_Przybysz](https://discuss.gradle.org/u/Tomek_Przybysz)\
**Post date:** [June 19, 2015, 12:59pm UTC](https://discuss.gradle.org/t/how-to-override-gradleapi-transitive-dependencies/10185/1 "2015-06-19T12:59:48Z")

</div>

Hi,

This or related questions appeared several times on the old forum, f.g.:

- [How to override gradleAPi() depedency?](https://discuss.gradle.org/t/how-to-override-gradleapi-depedency/6583)
- [Replace gradleApi() dependency with newer version?](https://discuss.gradle.org/t/replace-gradleapi-dependency-with-newer-version/5610/3)
- [Issues with gradleApi() and transitive dependencies](https://discuss.gradle.org/t/issues-with-gradleapi-and-transitive-dependencies/1185)

It’s been never answered though. So let me ask again, how this can be done?

I would like to upgrade groovy version as now I need to use different versions of Groovy in _buildSrc_ than in project modules. This further causes need of using different versions of Spock as well. I don’t like such an inconsistency at all but not only about disliking it is.  
Regarding [recent improvement](http://blog.jetbrains.com/idea/2015/03/faster-groovy-compilation-in-intellij-idea-14-1/) in IntelliJ IDEA can be used eclipse-groovy compiler to speed up in-IDE compilation. However I cannot specify different versions of groovy-eclipse-batch-xxx.jar for buildSrc than for the project modules which causes:

```
Error:Groovy-Eclipse: Groovy:Unexpected problem with AST transform: The Spock compiler plugin cannot execute because Spock 1.0.0-groovy-2.3 is not compatible with Groovy 2.4.3. For more information, see http://versioninfo.spockframework.org

```

Could anybody please advise how to override transitive dependencies brought by _gradleApi()_, please?

One more thing - why those dependencies are not listed by gradle _dependencies_ task?

---

<div class="post-metadata">

**Author:** ![mark\_vieira](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mark_vieira/32/5396_2.png) [@mark\_vieira](https://discuss.gradle.org/u/mark_vieira)\
**Post date:** [June 19, 2015, 1:33pm UTC](https://discuss.gradle.org/t/how-to-override-gradleapi-transitive-dependencies/10185/2 "2015-06-19T13:33:25Z")

</div>

Unfortunately there still isn’t a good way to do this. There is actually more to this problem than the compile time issue as Gradle internal libraries are exposed to plugins at runtime as well. Better plugin classpath isolation is on the roadmap and we have some design specs currently on how we might go about solving this problem.

---

<div class="post-metadata">

**Author:** ![Tomek\_Przybysz](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@Tomek\_Przybysz](https://discuss.gradle.org/u/Tomek_Przybysz)\
**Post date:** [June 22, 2015, 10:39am UTC](https://discuss.gradle.org/t/how-to-override-gradleapi-transitive-dependencies/10185/3 "2015-06-22T10:39:32Z")

</div>

Thanks for update on that.

Is there any reason why gradle’s dependencies are not added to classpath the same way as any other dependency is? I mean, so they would be visible through gradle _dependencies_ task and overridable as well?
