Problem updating an external jar in eclipse using gradle

1.7k Views Asked by At

I am having trouble deleting an external dependency from my build path. I have searched this site and the web but have not found a good answer.

I use gradle 4.9 and eclipse 4.7.3a to manage my automated tests. I have placed external jars in a folder named artifact in a git project's root directory.

My build.gradle file contains this line in the dependencies section:

compile fileTree(dir: "./artifact", include: '*.jar')

Well and good, it all works. However, when I try to delete a dependency using

Build Path > Configure Build Path... > Libraries > Project and External Dependencies all the buttons, including Remove, are grayed out.

I can delete the file from the artifact directory and issue

gradle cleanEclipse

from the command line but when I open Eclipse and try to open the project (under Project Explorer) I get 'Open Project' has encountered a problem. The project description file (.project) for 'project name' is missing.

After replacing the old jar with the new version (different file name of course), I tried running

gradle

which is supposed to recreate configuration files deleted by cleanEclipse. No joy. Next, I tried running

gradle build

But after restarting eclipse, still a failure. The only thing that worked was to delete the project from eclipse and then to re-import it.

Is there an easier way?

Thank you.

1

There are 1 best solutions below

0
MikeJRamsey56 On

Well, I found an answer.

After deleting and copying in the new jar file into the artifact directory, in eclipse, I selected Project > Clean ...

Then I right-clicked on the project and selected Gradle > Refresh Gradle project

I guess writing the question got me thinking about how eclipse handles .project files. Maybe this will help the next person.