Missing Project in the Java Build Path - Projects settings

Dime picture Dime · Mar 21, 2012 · Viewed 13.9k times · Source

There are two java projects imported into Eclipse workspace:

  • MainProject
  • SecondProject

The MainProject is required on the build path of the SecondProject.

Before I have migrated the source code of both projects to our Team Foundation Server, the MainProject was referenced in the properties of the SecondProject via the "Java Build Path" -> "Projects" tab. And everything worked fine.

Now, after both projects were imported from TFS to a clean Eclipse workspace via Team Explorer Everywhere plugin, the MainProject project is no longer visible on the "Projects" tab and in the "Add..." button dialog.

The funny thing is that the MainProject is also not visible, for example, in the Project -> Clean... dialog but it is visible in the project properties -> "Project References" dialog...

Where could be the problem???

Eclipse version 3.6.2 (Helios SR2), TFS 2010 SP1

P.S. If I add <classpathentry kind="src" path="/MainProject"/> to the .classpath by hand, an error "Project 'SecondProject' is missing required Java project: 'MainProject'" is shown.

Answer

CodeBlind picture CodeBlind · Mar 21, 2012

I may be completely wrong, but it sounds to me like Eclipse might not be seeing your imported TFS projects as "Java" projects (Eclipse also supports "plain" projects, among others). When you look at *.java files in the package hierarchy of your projects, do they have a solid-blue "J" in their respective icons or are they "hollow"?

If the former is true, then Eclipse IS seeing your projects as Java projects, I'll be thoroughly confused, and you can ignore my answer ;)

If the latter is true, then the project is not configured as a "Java project". This can be a real mess to deal with... but one solution in this case could be to rename your existing projects to something else (e.g. MainProjectOld, SecondProjectOld), create new "MainProject" and "SystemProject" projects as new "Java" projects, then copy all the source code from the old to the new source folders. I don't know much about TeamFoundationServer, but I would assume at this point you could reconnect your new projects with TFS and recommit them as the Java Projects they are.

EDIT

Bottom line is, if the latter is true, then it sounds like the project configuration XML files didn't make it into TFS, and Eclipse is confused about how it should treat the projects (plain, Java, or otherwise) after initial import from TFS. I've seen this happen in CVS and SVN as well, so I'm assuming it's a fairly common problem across any of the version control systems Eclipse supports. TFS may be included in that bunch.