views:

2759

answers:

1

I created a java project and then tried to import Java source code from two different projects. I've been working on it for a few hours, deleting and re-creating the project dozens of times to try to reconcile all of the messed up references between these two projects - which other people say are supposed to work together reliably.

What I'm doing is using svn to download the source from each project. And then using File-Import-File System in Eclipse. Once it's in Eclipse, I'm using the Refactor-Move command to move everything into the same src folder. That's where I get all the red marks indicating messed up references.

What's the right way to import Java source into Eclipse to avoid messing up references?

Surely not everyone goes about it the way I am doing it - or else no one would get anything done in Eclipse. My assumption here is that I am completely clueless about Eclipse and just don't know the easy way to reconcile these two batches of compatible code.

+3  A: 

Why do they have to be the same project? You could import then into two projects and have one depend on the other. Or have them both depend on a third project. If you still want one project, you can create a new source folder for each one instead of trying to move then into a single source folder. An eclipse project can have multiple source folders. Ideally, once you got it working, you'd also want to check in the eclipse project (.project file, .settings, etc) into svn also so others can check them out directly into eclipse instead of having to import into a new project every time. It would make versioning easier.

John Ellinwood
Ah, ok. I didn't know I could create two projects and then link them together. Of course that makes sense. How do you create this dependent relationship between them?
William
Would this be the way to link them: Build Path->Link Source. Or Java Build Path->Required Projects on the Build Path.
William
Right click on project. Properties. Project References. Then check the projects you want to reference. Also your required projects on build path works.
John Ellinwood
Awesome. Thank you!
William