ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leanne, Mui" <>
Subject How to Deploy file in hierarchy structure by build.xml
Date Sat, 11 May 2002 02:29:54 GMT

	Have anyone ever tried to use Ant to deploy file by build.xml? If I
want to compile and deploy file as following structure, how can I make my
                                                    |_catalog (it has
test1.class, test2.class)
                                                    |_include (it has
test3.class, test4.class)

Where should I place the Java files? Is it place under src directory? Can
you provide an simple example to tell me how to deploy project in package
My code doesn't deploy class file in package hierarchy, but it deploy as
following structure:
                                               |_classes (it has test1.class
~ test4.class)
My code:
<project name="test" default="dist" basedir=".">
<!-- set global properties for this build -->
<property name="context" value="test"/>
<property name="dist" value="dist"/>
<property name="src" value="src"/>
<property name="build" value="build"/>
<target name="init">
<!-- Create the build directory structure used by compile -->
	<mkdir dir="${build}"/>
	<mkdir dir="${build}/WEB-INF"/>
	<mkdir dir="${build}/WEB-INF/classes"/>
	<mkdir dir="${build}/WEB-INF/lib"/>
<target name="compile" depends="init">
	<!-- Compile the java code from ${src} into ${build}/WEB-INF/classes
	<javac srcdir="${src}" destdir="${build}/WEB-INF/classes" debug="on"
        	extdirs="${lib}" deprecation="on" />
	<copy preservelastmodified="yes" todir="${build}/WEB-INF/classes">
		<fileset dir="${src}" includes="**/*.properties">
	<!-- Copy files from ${web} to ${build} -->
	<copy preservelastmodified="yes" todir="${build}/web">
		<fileset dir="${web}" excludes="**/*.bak">

<target name="dist" depends="compile">
	<!-- Delete any directories expanded from the web archive in the
${dist}directory tree -->
	<delete dir="${dist}/${context}"/>

	<!-- Create the distribution directory -->
	<mkdir dir="${dist}"/>
	<!-- Put everything in ${build} into the ${dist}/${context}.war file
	<jar jarfile="${dist}/${context}.war" basedir="${build}"/>
Can anyone tell me how to fix it?

Best Regards,


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message