Frage

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.

War es hilfreich?

Lösung

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.

Andere Tipps

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.

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>

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top