6

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.

4 Answers 4

8

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.

5
  • 2
    Yes, this was exactly the case! Pity that I cannot upvote the answer several times :) "J" is present for all *.java files, but "J" was missing on the project icon. This was a good hint! Also the .project file was missing in TFS and that caused all those problems. <br> As fix you can manually modify .classpath file by adding <nature>org.eclipse.jdt.core.javanature</nature> and org.eclipse.jdt.core.javabuilder. At least this solved my problem.
    – Dime
    Mar 22, 2012 at 7:48
  • @Dime: A tip that (may) help if you don't want to check in your .project files (though that's what I would unofficially recommend): in the import from TFS wizard you can select "Show the New Project Wizard for folders that are not Eclipse projects" to customize .project creation on import. Mar 22, 2012 at 14:57
  • Awesome, glad it worked out! I struggled with the same problem while using CVS seemingly forever... glad you were able to get it resolved quickly :)
    – CodeBlind
    Mar 22, 2012 at 18:24
  • @Edward Thomson Thanks! But I do want to keep these files in TFS. Unfortunately they are excluded by Microsoft's plugin by default. So you have to manually uncheck them in Windows -> Preferences -> Team -> Ignored Resources.
    – Dime
    Mar 23, 2012 at 13:45
  • @Dime: interesting - .project is not in my Team Ignored Resources by default (Eclipse Classic 3.7). However, you're correct in that we do obey the Team Ignored Resources settings. Mar 23, 2012 at 15:27
1

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.

0
First go to your project root and edit .project file . make sure there have entry for javabuilder as following . If not then 
<buildCommand>
    <name>    org.eclipse.jdt.core.javabuilder    </name>
    <arguments>
    </arguments>
</buildCommand>
Full .Project file looks like.

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>Your Project </name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.common.project.facet.core.builder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
        <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
        <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
    </natures>
</projectDescription>
-1

I'm not familiar with Team Foundation Server, but I recommend to use Maven if you want to build projects inside and outside of Eclipse.

3
  • Your answer has no relevance to the question. Mar 21, 2012 at 16:59
  • ? Of course it has. And it's the recommended way, IMHO. Don't fiddle about with the .classpath file directly. Use Maven to build your projects. Then use a Maven plugin in your CI server.
    – Puce
    Mar 21, 2012 at 17:37
  • I think that indeed I misread the question. It seems to be about reimporting in Eclipse not building on TFS. Though that might be the next issue.
    – Puce
    Mar 21, 2012 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.