Each project is defined in an Ant file in the antBuildFiles directory. The purpose is to implement the top-level build targets for each project. Each of these project files inherits values from the top-level file, namely
jini.home
jini.jars
src
dist
build
httpd.classes
Each project uses only a small number of the files from the src directory; these are defined in the src.files variable. For example, for the complete.FileClassifierServer project discussed in Chapter 9, the source files are defined by
<property name="src.files"
value="
common/MIMEType.java,
common/FileClassifier.java,
complete/FileClassifierImpl.java,
complete/FileClassifierServer.java
"
/> Since Jini is a distributed system, not all class files are required by all components. Typically, a server will require some files whereas a client will require others. These are defined by two further variables:
<!-- Class files to run the server -->
<property name="class.files"
value="
common/MIMEType.class,
common/FileClassifier.class,
complete/FileClassifierImpl.class,
complete/FileClassifierServer.class
"
/>
<!-- Class files for the client to download --->
<property name="class.files.dl"
value="
complete/FileClassifierImpl.class
"
/>
The rest of each project file is fairly straightforward. The compile target compiles all files in the src.files list; the dist target builds .jar files (usually two of them: one for the server and one for the client); the deploy target copies the .jar files for the client to an HTTP server; and the run target starts a JVM with appropriate parameters. Note that the JVM must be started as a separate VM, as it sets a security policy (discussed later), which cannot be done within an already running Ant JVM.
The complete project file for complete.FileClassifierServer is in the file complete.FileClassifierServer.xml: