Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing Project in the Java Build Path - Projects settings

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.

like image 809
Dime Avatar asked Mar 21 '12 16:03

Dime


People also ask

How do you fix a build path problem?

Make sure that your source folder is listed within "Source folders in build path". If not add it using Add folder button. If problematic file is part of some jar - upon reaching here , click the libraries tab and make sure that the jar file is listed within "Jars and class folders on the build path".


2 Answers

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.

like image 102
CodeBlind Avatar answered Oct 19 '22 02:10

CodeBlind


You should make sure the application has .project, .project may not be available when you check out code from repository, You should create .project from command line in folder where your code is with 'mvn eclipse:eclipse' command and restart you eclipse.

like image 31
sai1979 Avatar answered Oct 19 '22 04:10

sai1979