I got the same. I think Eclipse is extremely unintuitive in this regard. I will go so far as to say it flat out sucks (the IDE as a whole is great, I am specifically unhappy about the new project / CVS behavior).
Complaint # 1: If I check out a new project from CVS, Eclipse has no idea it’'s a Java project (of course it never asks, and never gives me the option to change it once checked out). Thus the “compilation unit not on buildpath” error.
Complaint # 2: On the other hand, if I create a new, blank Java project in Eclipse, then check out a CVS project into this new, empty Java project, I get a superfluous layer of folder. Here’'s an example:
Say I have a project called “Foo” in CVS, and it has a typical directory layout (src, lib, webroot, etc.). Then I create a new Java project in Eclipse called “Foo,” (because that’‘s what the @)(#*$&!! project is called!!). Then I check the CVS “Foo” project out into the existing “Foo” Eclipse project. Now instead of my nice directory layout, I have Foo.src, Foo.lib, Foo.webroot. ???. A little steam is coming out of my ears at this point, but I proceed. I refactor everything, moving all the java files, jars, config docs and everything to their proper place. But what’‘s this? Now none of the files are showing that they are part of version control any longer. Right-click, choose Team --> Add to Version Control. Then Team --> Commit. Eclipse doesn’‘t send the root project folder, so CVS thinks I’'m trying to check things in to an empty folder:
Error: Foo: cvs : cannot add to /usr/local/cvsroot/CVSROOT/Emptydir
Lather, rinse, repeat with a few variations. You can definitely cook an egg on my head at this point. AAUUUGHHH!!!
The only way I got Eclipse and CVS to play nice together and not cause problems for the other developers was to do the following:
-
Check out my “Foo” project from CVS into Eclipse.
-
Create a new, empty Java project in Eclipse and name it “Bar.”
-
Open the Resource perspective
-
Copy the buildSpec and natures nodes from the .project file in the Bar project, and overwrite the corresponding nodes int the “Foo” project.
-
AHA, now Eclipse understands that “Foo” is a Java project!
-
Project --> Properties --> Java Build Path lets me specify the JDK, add the jars from the lib and stuff to my classpath.
-
Right-click on .project and .classpath and select Add to .cvsignore (so I don’'t torpedo the other guys with my settings).
Seems like a lot of headache. Am I missing something obvious?