Reputation: 328
Eclipse Gradle project shows dependency errors.
the container 'project and external dependencies' references non existing library
Upvotes: 12
Views: 12062
Reputation: 411
I tried all the suggestions above. Unfortunately, none of those steps helped me.
On Mac, this is what I had to do...
$ brew upgrade gradle
(this upgraded gradle from 5.0 to 6.7.1)...
$ cd /project_root
$ gradle help --scan
$ gradle wrapper --gradle-version 6.7.1
Upvotes: 1
Reputation: 328
Eclipse Gradle projects have a button to refresh the gradle project, but it is not really obvious and does not trigger when trying to 'quick fix' the error in eclipse.
This will remove the errors but could take a few minutes to process.
If the errors are still present in eclipse you should try to refresh dependencies and build with gradle outside of eclipse on the command line and see if that works to rule out eclipse/gradle sync as your issue.
Example of gradle command line to refresh and build (use gradlew if your using a gradle wrapper):
gradle clean
gradle --refresh-dependencies
gradle build -x test
gradle test (optional)
Upvotes: 6
Reputation: 76849
Based upon the feedback from the other answers, you probably should file an issue against Buildship, as this seems easy to reproduce. However, there already is one issue #985 filed, which states that the reason would / might be a read-only .classpath
or .project
files.
Upvotes: 0
Reputation: 44678
Got the same error. Gradle -> Refresh Project.. did not fix it.
Close Project, then Open Project did fix it.
Upvotes: 13
Reputation: 1176
I get this same error. It happens randomly every now and then, to most projects I have imported into Eclipse. Gradle misses some random dependency even though it's on the disc. Below image shows 6 different projects failing and next picture shows none-existing library reference actually exists.
.
A Gradle refresh usually does not solve it. To solve it I have to delete the project from Eclipse (not disc), then manually remove .classpath/.project files and .settings folder, then import project into Eclipse again. Very annoying :/
Upvotes: 2