You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "G.Nagarajan" <gn...@dkf.de> on 2000/11/30 13:27:21 UTC

using ant in windows nt

Hi,
I am using ant for building and compiling my web application on windows nt.
I modified the sample build.xml which comes with tomcat. The problem is
the application is deployed under a directory called "null" in the directory
where I run build.bat. I tried running ant separately using the ant command
and -Dtomcat.home=%tomcat_home%, but still it is creating the null
directory.

any help will be appreciated.
Thanks
Nagaraj.

The build.xml is as follows

<project name="test" default="compile" basedir=".">

<property name="app.name" value="test"/>
<property name="deploy.home" value="e:\tomcat\webapps\ib"/>
<property name="dist.home" value="${deploy.home}"/>
<property name="dist.src" value="${app.name}.jar"/>
<property name="dist.war" value="${app.name}.war"/>
<property name="javadoc.home" value="${deploy.home}/javadoc"/>

<target name="prepare">
    <mkdir dir="${deploy.home}"/>
    <copydir src="web" dest="${deploy.home}"/>
    <mkdir dir="${deploy.home}/WEB-INF"/>
    <copyfile src="etc/web.xml" dest="${deploy.home}/WEB-INF/web.xml"/>
    <mkdir dir="${deploy.home}/WEB-INF/classes"/>
    <mkdir dir="${deploy.home}/WEB-INF/lib"/>
    <copydir src="lib" dest="${deploy.home}/lib"/>
    <mkdir dir="${javadoc.home}"/>
  </target>

<!-- clean up the target directory -->
<target name="clean">
	<deltree dir="${deploy.home}"/>
</target>

<!-- compile target, to compile the java classes that make up this
application -->
<target name="compile" depends="prepare">
	<javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
		classpath="${deploy.home}/WEB-INF/classes"
		debug="on" optimize="off" deprecation="off"/>
</target>

<!-- The javadoc directory -->
<target name="javadoc" depends="prepare">
	<!-- Example not given -->
</target>

<target name="all" depends="clean,prepare,compile,javadoc"/>

<!-- The distribution target -->
<target name="dist" depends="prepare,compile">
	<jar jarfile="${dist.home}/${dist.src}" basedir="."/>
	<jar jarfile="${dist.home}/${dist.war}" basedir="${deploy.home}"/>
</target>
</project>


The build.bat file
------------------
@echo off
rem Build Script for "ib"
rem Identify the custom class path

if "%CLASSPATH%" == "" goto noclasspath
set _CLASSPATH=%CLASSPATH%
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%/classes
goto restclasspath
:noclasspath
set _CLASSPATH=
set CLASSPATH=%TOMCAT_HOME%/classes
:restclasspath
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%/lib/jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%/lib/servlet.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%/lib/webserver.jar

ant -Dtomcat.home=%TOMCAT_HOME% %1 %2 %3 %4 %5 %6 %7 %8 %9

rem clean up classpath
set CLASSPATH=%_CLASSPATH%
set _CLASSPATH=