Ant Build Commands

Apache Ant is used to build coursework systems. As is evident from the other sections of this manual, Ant is used to create directories, copy files, perform keyword substitution on files, and to compile Java code. It is also used to check question packages into and out of the CVS repository. It is not used to perform the first checkout of an @systemname; system from the CVS repository, because it is at this this first checkout that the ant build file, "build.xml", is itself retrieved from the repository. This section lists the commands available within the build file. The commands are listed in the order that they might be used, although all but the first build command are likely to be used several times:-

Build commands available from the build file

ant -DappName=course_name createnewcourse

This command creates and populates an initial set of directories for setting up a new coursework withithin the "courses" directory, see . Thus it creates the Home directory, its sub-directory packages, and the dtd sun-directory within this. This last directory is populated with a copy of the QuestionDocument.dtd file, while a basic coursework definition file is placed in the "Home" directory: his file has to be edited to customise the coursework before operations can be performed.

ant -DappName=D2 createnewcourse

would create the directory "D2Home" within the "courses" directory, and then create directories "courses/D2Home/packages" and "courses/D2Home/packages/dtd". It would also create the files "courses/D2Home/D2.def" and "courses/D2Home/packages/dtd/QuestionDocument.dtd".

ant -DappName=course_name

After editing of the document definition file in the coursework home directory by the Ant create new course build command. This command can be used to create and populate the coursework's web applications directory within the coursework's "Home" directory: see and the Section called Tomcat Web Application Directory Structure in the chapter called Tomcat and the Tomcat Web Application Directory Structure. This build command reads in the coursework definition file, which is named after the coursework, see the chapter called Coursework Definition File.

Thus, the command:-

ant -DappName=D2

would read in "courses/D2Home/D2.def" and then, if they didn't exist, it would create the directory "courses/D2Home/D2" and the necessary directories below this, see the Section called Tomcat Web Application Directory Structure in the chapter called Tomcat and the Tomcat Web Application Directory Structure. It would then populate this directory structure by copying in the appropriate files from the "src" directories, performing keyword substitution, and compiling Java files, see .

If these directories and files already exist, then they are freshened. This command can be performed at any point to ensure that the application code is up to date.

ant -DappName=course_name

This checkouts a package from the CVS repository into the coursework's packages directory. The "appName" property on the command line gives the name of the coursework within which the new package is to be created and the "package" property gives the name of package to extract. Currently, the package created uses the same name as used in the repository, that given by the "package" property.

Thus, the command:-

ant -DappName=D2 -Dpackage=Laplace addPackage

would check out the package "Laplace" from the CVS repository and place in the directory"courses/D2Home/packages/Laplace", populating it with the directories and files in the repository. It is not necessary that the repository package has all the directories defined in the chapter called Topic Packages.

ant -DappName=course_name -Dpackage=package_name createnewpackage

This creates a new package with the coursework's packages directory. The "appName" property on the command line gives the name of the coursework within which the new package is to be created and the "package" property gives the name of the new package.

Thus, the command:-

ant -DappName=D2 -Dpackage=Fourier createnewpackage

would create the directory "courses/D2Home/D2/packages/Fourier", and populate this directory with sub-directories ready for creation of a new package: directories "help", "images", "image-xml", "initParameters", "java", "jsp", "qList" and "xml" ready for populating with relevent files for a set of questions, see the chapter called Topic Packages. It also creates in the xml sub-directory a file which has the outline elements for a new coursework with the appropriate courework and package names inserted.