Converting a CVS Module into an Eclipse Java Project
To create a Java project from a CVS module, there are two approaches. The one you choose depends on whether or not the module was previously checked in as an Eclipse project or not.
First, determine if the CVS module is already an Eclipse project. You can do this by checking to see if it has a .project file containing XML like the following:
Figure 1: Sample .project file
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>Foo</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> </projectDescription>
Note that if the .project file looks something like the following
Figure 2: Modified .project file
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>Fee</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription>
(note the java builder and nature specification), then it's already a Java project and you can simply check it out into Eclipse.
If there isn't a .project file, just use Method One.
This is the simplest way to convert the CVS module into a Java project.
- From the CVS perspective in Eclipse, locate the module to check out.
- Right click on the module and choose Check Out As...
- Choose Java Project as the type and press Finish
Once you've done the above, Eclipse will checkout the module as a project and create a .project and .classpath file. Eclipse does a very good job of figuring out which directories should be source directories.
I recommend you check the project back into CVS to save the .project and .classpath files.
- Checkout the CVS module outside of Eclipse
- Start Eclipse if it's not already started
- Choose New Project and select Java Project
- On the screen that asks for the project name, uncheck the Use
default box and browse to the directory where the checked out CVS module
- Enter a project name (it doesn't have to match the CVS module name, but
it's generally not a bad idea)
- Press Finish
Once you've done the above, Eclipse will create a .project and .classpath file in the directory where the CVS module resides. Eclipse does a very good job of figuring out which directories should be source directories.
- Set up the Java Build path as you would for any other Java project.
(Note that I always recommend using classpath variables...)
- Right click on the project and choose Team->Share Project
- When asked, tell eclipse that you want to use existing CVS information.
Eclipse will see the CVS metadata that was checked out from step one above.
- Synchronize your project -- this will check in the .project and .classpath files
Note: The project will not exist under /eclipse/workspace! It still remains where you checked it out! If you delete the project and choose "also delete contents" the contents of the dir you checked out from CVS will be deleted.
Unless you prefer having your project contents outside the workspace directory, I like to recommend that after you've checked in your changes, you delete the project (and its contents) and re-check it out from inside Eclipse. I've seen too many folks do lots of edits, then come in the next day and delete the directory they chose for step 1, thinking that Eclipse copied it...