Differences in intellij and gradle dependency resolution
Hi!
I have some trouble with dependencies when running tests inside of Intellij. The project is a gradle project.
I have multiple dependencies on bytebuddy, one dependent on version 1.9.5 and another on version 1.9.7. The 1.9.5 dependency is defined for the "compile" source set in gradle, and shows up as a "compile" dependency in IntelliJ - so far so good. The 1.9.7 dependency is for "testCompile" in gradle and shows up as "test" in IntelliJ - also looks good.
However, this conflict is resolved differently by IntelliJ and Gradle when running: gradle upgrades to 1.9.5 dependency to 1.9.7 (which works), while IntelliJ puts both on the classpath. However, it seems IntelliJ always puts the imported dependencies in the order "compile" followed by "test", so at runtime the 1.9.5 version is used, leading to "NoSuchMethod".
Everything works in IntelliJ if I rearrange the dependencies of the module so that 1.9.7 is on top of 1.9.5, but since this is a gradle-linked project that is overwritten anytime IntelliJ re-synchronizes with gradle.
Is there any way to force IntelliJ to put the dependencies in another order? Or to force it to attempt to resolve/detect the conflict?
I'm using 2018.2.4 Community Edition right now, but upgrading/downgrading is certainly an option.
Thanks!
Please sign in to leave a comment.
It seems to be not possible currently, but here's a feature request for it: https://youtrack.jetbrains.com/issue/IDEA-100774 .
Aha, unfortunate! Thanks for the link, but guessing from the dates I shouldn't assume this will be resolved soon :)
Thanks for the response!