I'm trying to upgrade to Gradle 5, but am getting "Unresolved reference" errors when compiling - most of which are internal libraries that are within a classpath. Additionally, the javax.inject library somehow doesn't exist anymore.
I've tried individually adding in the libraries that are now missing, but it then fails to build for some reason (with some sort of abstract method error).
buildscript {
...
dependencies {
classpath "some-internal-classpath"
}
}
How do I get it so that Gradle 5 will be able to resolve those references from my internal classpath + have javax.inject again?
When upgrading to Gradle 5.x from Gradle 4.x, there is one change in behaviour that can cause what you observe:
runtime
scope of Maven is no longer visible at compilation.So the fix is usually to find out the libraries you were using in your code but did not depend upon explicitly.
A useful method for doing that investigation is to leverage the dependencies
task of Gradle, focused on the compileClasspath
, effectively running ./gradlew dependencies --configuration compileClasspath
with Gradle 4.x and 5.x and analysing the differences.