5

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.

daveb
  • 74,111
  • 6
  • 45
  • 51
  • If you try to click through or use F3 on a class in a different project, does that work? – Thimmayya Nov 11 '09 at 05:22
  • Yes. Ctrl-Shift-G also works. – daveb Nov 11 '09 at 17:58
  • I tried out a test-case withlinked source files and it worked as expected. Is it possible that a partial refactoring takes place and some files are not fully refactored? – Thimmayya Nov 11 '09 at 18:33
  • Yeah, I'm not sure what's going on. It works for co-workers. In any case, I've got rid of the linked source folders, I'm now using symlinks in the project folder, and it's all gravy. – daveb Nov 11 '09 at 22:50

3 Answers3

1

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.

Miguel Ping
  • 18,082
  • 23
  • 88
  • 136
0

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?

  • The project dependencies are correct. A linked source folder is a source folder that is not in your project, but located elsewhere. To see this, edit a project's build path, and then In the source tab you'll see a button to "Link Source". I have linked source folders in this way – daveb Nov 11 '09 at 17:57
0

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...

PaulP1975
  • 528
  • 1
  • 5
  • 12