ant-user mailing list archives

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

	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
build.xml?
  $tomcat_home\test\build\WEB-INF
                                           |_classes
                                                    |_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
hierarchy?
My code doesn't deploy class file in package hierarchy, but it deploy as
following structure:
  $tomcat_home\test\build\WEB-INF
                                               |_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> 
<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">
		</fileset>
	</copy>
	<!-- Copy files from ${web} to ${build} -->
	<copy preservelastmodified="yes" todir="${build}/web">
		<fileset dir="${web}" excludes="**/*.bak">
		</fileset>
	</copy>
</target>

<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}"/>
</target>
</project>
Can anyone tell me how to fix it?


Best Regards,

Leanne


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message