Java Reference
In-Depth Information
<java classname="sample.PostAdvert" classpathref="classpath.base">
<arg value="jeff"/>
<arg value="kitsch"/>
<arg value="Inflatable Sofa"/>
<arg value="Leopard skin pattern. Nice."/>
</java>
</target>
<target name="listAdverts" depends="compile">
<java classname="sample.ListAdverts" classpathref="classpath.base"/>
</target>
</project>
The properties file imported in the first line provides the paths to your installed libraries,
and you should adjust it as appropriate (as shown in Listing 3-2). If you unpack Hibernate 3.2.0,
it will create a directory called
hibernate-3.2
, which we have renamed to the full version path;
we have done something similar with the HSQL database directory.
The Hibernate Tools archive currently unpacks to two directories (
plugins
and
features
).
We have created a parent directory to contain these. The path to the appropriate JAR file
(
hibernate-tools.jar
) within the unpacked directory is dependent upon the specific Hiber-
nate Tools version, so we have added the
hibernate.tools.path
property to point our build
script at this.
Listing 3-2.
The
build.properties
File to Configure the Ant Script
# Path to the hibernate install directory
hibernate.home=/hibernate/hibernate-3.2.0
# Path to the hibernate-tools install directory
hibernate.tools.home=/hibernate/hibernate-tools-3.1
# Path to hibernate-tools.jar relative to hibernate.tools.home
hibernate.tools.path=/plugins/org.hibernate.eclipse_3.1.0/lib/tools
# Path to the HSQL DB install directory
hsql.home=/hsqldb/hsqldb-1.8.0.2
Aside from the configuration settings, the only oddity in the
build.xml
file is the configu-
ration and use of a Hibernate-specific Ant task. The
taskdef
(shown in Listing 3-3) makes this
task available for use, using the appropriate classes from the
tools.jar
file.
Listing 3-3.
Defining the Hibernate Tools Ant Tasks
<taskdef name="htools"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="classpath.tools"/>
Search WWH ::
Custom Search