How to override gradleApi() transitive dependencies?


(Tomasz Przybysz) #1

Hi,

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

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 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?


(Mark Vieira) #2

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.


(Tomasz Przybysz) #3

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?