1

My project does not compile because I have configured my build.gradle to use commons-cli-1.3, while gradle uses commons-cli-1.2:

compile 'commons-cli:commons-cli:1.3' 

If I do dependency insight properly shows what I expect:

commons-cli:commons-cli:1.3 \--- compile 

However, if I inspect configurations.compile.asPath I will see lib/plugins/commons-cli-1.2.jar on the path before commons-cli-1.3.jar!

This appears to be because I have project dependency on a project that has compile dependency gradleApi() - which uses the 1.2.jar (not reported in dependencyInsight)

I see this happening in gradle 2.3 and 2.7, at least.

Anyone run into this and have a solution? Seems like pretty junky and non-transparent behavior on gradle's part

1

1 Answer 1

1

So, here's what I did to solve it, in my case... instead of using gradleApi() in my other project dependency, I added these explicitly:

compile 'org.gradle:gradle-core:2.6' compile 'org.codehaus.groovy:groovy-all:2.4.5' 

Even if this didn't solve my issue (which it did), this does then make these dependencies more easy to see/manage e.g. adding {exclude:} clause, etc. I guess gradleApi() is just a terrible "convenience" feature (see long-standing bug: https://issues.gradle.org/browse/GRADLE-1715)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.