Eclipse rename not working completely

5.4k views Asked by At

Ok I'm completely googled-out.

I have a few java projects in my eclipse workspace (about 25).   Most projects use linked source folders.

When I rename a class in Project1, the references to that class in the other projects are not updated. The references within the project are updated just fine.   The net result is compilation errors on the next automatic recompile.

I'm using Eclipse 3.5.1, but the same behavior was shown by 3.4.0 and 3.4.2

Any ideas about how to fix this?

My current plan - after googling for 20 minutes - is to write a script to convert the linked source folders to be OS links (I'm on linux) in the project folders themselves.   So then I'm no longer using linked source folders.

3

There are 3 answers

1
Philippe Faes On

Cross-project renames work just fine if your projects depend on each other. What exactly do you mean with linked source folders: do you link to the same source folder more than once?

0
Miguel Ping On

Like Philippe Faes said, it works fine if your projects are set as a dependency on each other. Make sure that your project's build path are set up that way.

IMHO linked folders are for external files, not for another projects.

Another problem is that if you are just referencing a jar as a dependency (ie, on the project's class path), eclipse will not be able to know that the jar was build based on another project's source thus will not refactor properly.

Try to ask your colleagues for the eclipse project files (.project and .classpath) and edit the files if you need, then check if your refactor still doesn't work. I am guessing that your project is set up differently than your colleagues.

0
PaulP1975 On

This is a shot in the dark, but make sure that your project is a Java project. I am not sure if other project types (like the generic Project) might not refactor properly. I have never seen this problem before and it has always worked as expected for me...