3.19 Checking Out Code from CVS

3.19.1 Problem

You want your Ant buildfile to check out code from CVS before compiling.

3.19.2 Solution

Use Ant's cvs task.

3.19.3 Discussion

You can use the cvs Ant task to execute any CVS command. In order for this to work, you must have installed the cvs executable on your system path. If Ant does not find cvs, it issues an error and the build fails.

By default, the cvs task executes a checkout command. Here is the syntax to checkout the cookbook module from CVS:

<cvs cvsroot="${cvsroot}"
     package="cookbook"/>

You can also execute any other CVS command, such as update as shown here:

<cvs command="update -dP"
     cvsroot="${cvsroot}"
     dest="cookbook"/>

This tells CVS to update the most recent files in the cookbook directory, creating missing directories and pruning empty directories.

If cvsroot is not specified, the already-defined CVS root from the checked out project is used.

3.19.4 See Also

See the CVS documentation for information about all of the CVS commands.