How to override gradleAPi() depedency?

(Maciek Opała) #1

Hi, It seems that gradle 1.6 uses older version of guava (11). I’ve a gradleApi() dependency in my build.gradle but also need to use newer version (14) of guava with tests. How can I achieve this?

How to override gradleApi() transitive dependencies?
(Peter Niederwieser) #2

What do you mean by “with tests”? Is the newer Guava version needed by a Gradle plugin that you are writing? What exactly have you tried so far, and what was the result?

(Maciek Opała) #3

Hi Peter,

Thanks for prompt response. By saying “with test” I thought that build was failing when executing test - not exactly build but tests to be precise - with MissingMethodException.

In my dependencies section I have

dependencies {
    compile ''

I use gradle 1.6 version that has internal guava jar (version 11 - AFAIR). These dependencies are conflicted, is there any way to solve it?

(Peter Niederwieser) #4

This syntax is incorrect. Correct is ‘compile gradleApi()’. Does this solve the problem? If not, try to declare Guava first, and post the stack trace that you are getting.

(Maciek Opała) #5

Peter sorry, for being imprecise. Of course ‘gradleApi()’ is prepended with ‘compile’. And the problem still exists. I’ll try it later because currently I’ve just picked up the guava method I’m interested at and carried on with work.

(Robert Sandell) #6

I have the same problem. Tried to put the guava 14 dependency first in the dependency list but that gave no effect.