Missing dependencies after renaming project in eclipse

316 Views Asked by At

I have a perfectly fine working maven project in eclipse. The project has some dependencies. I can run the Maven build up to 'deploy' with no issues. The project in question is sort of a template for future use. Therefore in general it should work like this: checkout from repo -> rename -> maven build -> ready to go. So as mentioned, after checkout it builds fine, but as soon as I change the name of the project via the 'Refactor->rename' feature, the eclipse maven plugin seems to not pick up that change correctly. My dependency is now lost and multiple compiling errors due to unknown classes pop up. After removing the dependencies from my pom.xml, running maven 'clean install', reinserting the dependencies, running maven again, it works. The 'Maven->update project' feature does nothing. A refresh(F5) on the project does nothing. Only deleting and reinserting the dependencies to pom.xml seem to work. Questions:

  • can I somehow NOT do the delete/reinsert shenanigans?
  • what else got lost in translation when I changed the projects name?

EDIT: to be clear, the 'deleting the dependencies and running clean install' mentioned above is not that easy of a task, as you'd have to remove every reference to dependencies temporarily somehow and then rolling back this change after a successful first 'install'. I've tested the behaviour on a test project, so there it was no problem. But I'd rather not do that for the real template project.

1

There are 1 best solutions below

0
On

I figured it out. You need to use the 'Refactor->Rename Maven Artifact' feature from the context menu of the project instead of the 'Refactor->Rename' feature from the same location. In the dialog there even is a checkbox to change the project name in eclipse in one go. Changing the name with this feature does not result in broken dependencies.