ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karsten Wutzke <kwut...@starconcept.de>
Subject Background task to start Tomcat 4.1
Date Wed, 09 Apr 2003 18:34:50 GMT
How do I run a background task to start Tomcat 4.1 in Ant? I want to 
start the server, if it is not running yet. However, the <exec> and 
<java> tasks I tried don't seem to be able to do that. I also tried 
<parallel>, but Ant just seems to hang on that task.

The target I wrote:

<property name="local.bootstrap.class" 
value="org.apache.catalina.startup.Bootstrap"/>

<property name="local.bootstrap.jar.file" 
location="${env.CATALINA_HOME}/bin/bootstrap.jar"/>

<path id="local.bootstrap.classpath">
   <pathelement path="${local.bootstrap.jar.file}"/>
</path>

<target name="start-local" description="Starts local Tomcat.">
   <!-- server already running? yes:bye, no:startup ... but how? -->
   <java classname="${local.bootstrap.class}" fork="true">
     <classpath refid="local.bootstrap.classpath"/>
     <arg value="start"/>
     <sysproperty key="java.endorsed.dirs" 
value="${env.CATALINA_HOME}/bin:${env.CATALINA_HOME}/common/endorsed"/>
     <sysproperty key="catalina.base"      value="${env.CATALINA_HOME}"/>
     <sysproperty key="catalina.home"      value="${env.CATALINA_HOME}"/>
     <sysproperty key="java.io.tmpdir" value="${env.CATALINA_HOME}/temp"/>
   </java>
</target>

I drew the Java system properties from the startup scripts in the Tomcat 
bin directory, especially catalina.sh.

The task itself works fine. It starts up the server, however... Ant 
hangs, because the task is not run in the background...

Can it be done, so that the task is spawnes in the background? What 
about the <spawn> task I've heard about? Does it live?

Karsten



Mime
View raw message