Trip and Tick 3: Checking In a java.net project using CVS.exe
Say you got some code you wanna put up as a java.net project. You create a java.net project,
you create a Netbeans project, but you run into some CVS snags along the way...
align="left" vspace="8" hspace="8" />
Prequels: This Trip and Tick series kicked off with
Checking out a java.net project
and continued with
JooJ up your project page with a Web Start demo .
I dunno if it's just me, but the few times i've tried to setup a new java.net project,
that is to get my Netbeans project/source and the java.net CVS married and
checked in, i seem to struggle for hours. But no more! Today we gonna make it happen
in 5 minutes or die trying, goddammit!
The trick is, we gonna add a command-line CVS client to our arsenal
to beat Netbeans to the punch, if it comes to that, which it does.
I downloaded a cvs.exe from
via cvs.nongnu.org .
So if you got any code of your own lying around, c'mon, let's do this! First request
a Java project (it's quick and easy), which will get created right away, but only be visible by yourself
until it's been approved. Incidently, this might take anything from a few days to a few weeks.
Ample time to tell All Staff the good news that the crown jewels are going opensource ;) Incidently, i wrote an article on opensource licenses, called CDDLing up with Sun , to explain to myself the diffferences between GPL, MPL, ASL, and CDDL, so...
We use our command-line cvs client to checkout the new java.net project into our CVS projects
directory. In this example, the java.net project is vellum (as in vellum.dev.java.net)
so substitute vellum with your own project name.
And USER with your java.net username.
cvs -d :pserver:USER@cvs.dev.java.net:/cvs co vellum
Since it's a new project (on java.net), all it will contain
is a www directory. We need to make a src directory,
which we do, and we need to add that to the CVS, which we do, using our cvs client.
cvs add src
Our cvs client will look at the CVS/Repository file to get the repository,
so we don't need to specify it as before ie. -d :pserver:USER@cvs.dev.java.net:/cvs.
Now if we look at the CVS/Entries file, it will reflect both
the www and src directories.
And we can browse the CVS source on our java.net project page to see that it's there too. Supoib!
align="left" hspace="8" vspace="8">
Now that we have a source directory, we can create a Netbeans project, and specify this source
My project properties are as follows, where as you can see, the CVS/source
for the project is off a projects subdirectory, and netbeans project files are in a separate
nbprojects directory, because i like to keep these separate.
When things go wrong, we might use cvs remove to remove stuff from the CVS
(after you have deleted it locally). Also, we can use cvs update to recover stuff
from the java.net CVS that we've deleted locally
(and haven't yet done a cvs remove on).
When things go really wrong, just start from scratch by removing your project
directory eg. /projects/vellum, and checking it out again...
Remember, that whenever you create a new file or directory (in the command-line) you have to do cvs add
on that file to get it into the CVS. And whenever you delete something, you gotta do
a cvs remove on it to get it out of the CVS. That's what's great about IDEs,
that they keep track of new and deleted (and renamed) files,
and handle all this CVS drudgery for you :)
align="left" vspace="0" hspace="8" />
Anyway, we just use the command-line cvs for the bare minimum, that is to
add our empty src directory to CVS before creating the Netbeans project.
Now we need to copy our source into this src directory, assuming we have
some source for the new project already. If the source is "tainted" by CVS directories
from before, then we first make it "pristine" by searching for any old "CVS" directories and deleting them all.
For example in Windows Explorer, we search for all files containing "CVS" in the file name,
Ctrl-A to select them all, and Delete.
Then we can drop our "CVS-free" source tree into our src folder,
make sure the project compiles, and then get our IDE to do a "cvs commit" for us,
to add all these "new" files it finds to our CVS java.net repository.
But as a rule do a "cvs update" before committing. Then Netbeans knows for sure
that all these new files aren't in the CVS repository yet.
Our Netbeans and java.net projects are now forged into "one ring to rule them all"
:) And we can forget about cvs.exe... till next time.