That looks like a good idea and I tried it:
<target name="deploy-war" depends="concepweb-war">
<delete dir="${tomcat.home}/webapps/ConcepWeb" />
<copy file="${build.classes.dir}/ConcepWeb.war"
todir="${tomcat.home}/webapps" />
</target>
<target name="test" depends="deploy-war">
<exec dir="${tomcat.home}/bin" vmlauncher="false"
executable="shutdown.bat" />
<exec dir="${tomcat.home}/bin" vmlauncher="false"
executable="startup.bat" />
</target>
</project>
but it doesn't seem to work. Results:
build ant-test
Buildfile: build.xml
.................
................
................
deploy-war:
[delete] Deleting directory C:\Tomcat324\webapps\ConcepWeb
[copy] Copying 1 file to C:\Tomcat324\webapps
BUILD SUCCESSFUL
Total time: 2 seconds
It builds OK, but does not shutdown or open Tomcat? Am I doing something
obviously wrong?
I have included the whole build.xml file below.
----------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<project name="ConcepWeb build script" default="deploy-war" basedir=".">
<property name="app.name" value="ConcepWeb"/>
<property name="tomcat.home" value="C:\Tomcat324" />
<property name="dist.src" value="${app.name}.jar"/>
<property name="dist.war" value="${app.name}.war"/>
<!-- <property name="javadoc.home" value="${deploy.home}/javadoc"/> -->
<property name="build.classes.dir" value="${basedir}/build-cweb"/>
<!-- need to add in details of src.dir -->
<property name="src.dir" value ="${basedir}"/>
<!-- use this to set the classpath of the project. Later it gets used under
javac. -->
<path id="base.path_23">
<pathelement location="{tomcat.home}/lib/servlet.jar"/>
</path>
<!-- compiles all .java files under /app/WEB-INF to the build-cweb dir -->
<target name="compile">
<delete dir="${build.classes.dir}"/>
<mkdir dir="${build.classes.dir}"/>
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
debug="on"
deprecation="on"
optimize="off" >
<classpath path="${classpath}" />
</javac>
</target>
<!-- build.classes.dir = ConcepWeb/app/build-cweb -->
<target name="cweb-jar" depends="compile">
<!-- <delete dir="${build.classes.dir}/WEB-INF"/> -->
<mkdir dir="${build.classes.dir}/cweb"/>
<copy file="${build.classes.dir}/cweb/dbMgr/DatabaseManager.class"
todir="${build.classes.dir}/WEB-INF/lib/cweb/dbMgr" />
<copy
file="${build.classes.dir}/cweb/exceptions/DatabaseConnectException.class"
todir="${build.classes.dir}/cweb/exceptions" />
<copy
file="${build.classes.dir}/cweb/exceptions/DatabaseQueryException.class"
todir="${build.classes.dir}/cweb/exceptions" />
<copy
file="${build.classes.dir}/cweb/exceptions/DatabaseUpdateException.class"
todir="${build.classes.dir}/cweb/exceptions" />
<copy file="${build.classes.dir}/cweb/util/MarkUp.class"
todir="${build.classes.dir}/cweb/util" />
<jar jarfile="${build.classes.dir}/cweb.jar">
<fileset dir="${build.classes.dir}">
<include name ="cweb/dbMgr/*.class" />
<include name ="cweb/exceptions/*.class" />
<include name ="cweb/util/*.class" />
</fileset>
</jar>
</target>
<!-- ConcepWeb web app war -->
<target name="concepweb-war" depends="cweb-jar">
<mkdir dir="${build.classes.dir}/WEB-INF/classes/cweb/sMgr"/>
<copy file="${src.dir}/src/web.xml" todir="${build.classes.dir}/WEB-INF" />
<copy file="${build.classes.dir}/cweb.jar"
todir="${build.classes.dir}/WEB-INF/lib" />
<!-- need to specify the servlets individually from the build directory
and separate them out to the WEB-INF directory -->
<copy file="${build.classes.dir}/cweb/sMgr/SessionAllocator.class"
todir="${build.classes.dir}/WEB-INF/classes/cweb/sMgr" />
<!-- need to copy the general web pages to the build directory.
Sometimes wildcards work, ie *.html, or *.jsp, -->
<copy file="${src.dir}/ocean.css" todir="${build.classes.dir}" />
<copy file="${src.dir}/manipulation.js" todir="${build.classes.dir}" />
<copy file="${src.dir}/e_nameForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/e_propForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/e_parForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/e_intForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/e_extForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/e_attForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/r_nameForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/r_propForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/r_parForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/r_linkForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/r_attForm.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/toolbar.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/addEntityFrameset.htm"
todir="${build.classes.dir}" />
<copy file="${src.dir}/addRelationFrameset.htm"
todir="${build.classes.dir}" />
<copy file="${src.dir}/schemaFrameset.htm" todir="${build.classes.dir}" />
<copy file="${src.dir}/addEntity.jsp" todir="${build.classes.dir}" />
<copy file="${src.dir}/addRelation.jsp" todir="${build.classes.dir}" />
<copy file="${src.dir}/schema.jsp" todir="${build.classes.dir}" />
<jar jarfile="${build.classes.dir}/ConcepWeb.war">
<fileset dir="${build.classes.dir}">
<!-- use wildcards to pull in all of the required files -->
<!-- <include name="WEB-INF/**"/> -->
<include name="WEB-INF/lib/cweb.jar"/>
<include name="WEB-INF/classes/cweb/sMgr/*.class" />
<include name="*.jsp"/>
<include name="*.htm"/>
<include name="*.xml"/>
<include name="manipulation.js"/>
<include name="ocean.css"/>
</fileset>
</jar>
</target>
<target name="deploy-war" depends="concepweb-war">
<delete dir="${tomcat.home}/webapps/ConcepWeb" />
<copy file="${build.classes.dir}/ConcepWeb.war"
todir="${tomcat.home}/webapps" />
</target>
<target name="test" depends="deploy-war">
<exec dir="${tomcat.home}\bin" vmlauncher="false"
executable="shutdown.bat" />
<exec dir="${tomcat.home}\bin" vmlauncher="false"
executable="startup.bat" />
</target>
</project>
At Wednesday 2/20/2002 03:58 PM, you wrote:
>I use
>
><target name="deploy" ...>
><war warfile="${warname}.war" webxml="WEB-INF/web.xml">
> <classes.. />
> <lib ... />
> <fileset ..jsps../>
></war>
></target>
>
><target name="test" depends="deploy">
><exec dir="${tchome}\bin" vmlauncher="false" executable="shutdown.bat"/>
><delete dir="${tchome}\webapps\${warname}" />
><exec dir="${tchome}\bin" vmlauncher="false" executable="startup.bat"/>
></target>
>
>The drawback is that ant carries on running until tomcat is stopped, since
>it started it. It should be possible to do something with a bat file
>containing start startup.bat or similar but I haven't managed to get it to
>work, and don't mind this behaviour anyway.
>
>
>Best Wishes
>John Burgess
>[EMAIL PROTECTED]
>Tel: 01865 718666
>Fax: 01865 718600
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, February 20, 2002 2:19 PM
>To: [EMAIL PROTECTED]
>Subject: Invoking Tomcat
>
>
>Hi,
>
>Is it possible for Ant to shutdown Tomcat if it is already running, build
>my web archive and after deploying it to start Tomcat up again if the build
>is sucessful? This would save me typing:
>
>shutdown
>build
>startup
>
>every time I want to run my web app.
>
>
>D. Clarkson
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.325 / Virus Database: 182 - Release Date: 19/02/02
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.325 / Virus Database: 182 - Release Date: 19/02/02
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>