ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Skripczynski <>
Subject Re: make ant ignore forked thread
Date Wed, 07 May 2003 10:49:26 GMT
Hi Steffen,

I wanted to run tomcat just using the <java> task, as the exec task
limits me to the os specific commands (for tomcat startup.(bat|sh)).

But actually I can specify everything comcat needs inside one <java> task
(with classpath, properties...), thus using ants ability to hide the OS from
the script (i'm lazy).

So it seems, that currently the <java> task does not support to detach (?) a
thread | forked jvm, it has started ?

To me it seems a great feature, having a single startup ant-script for a java
based server. 

Is it possible to add an additional tag to the <java> task like
'daemon="yes"' needing 'fork="yes"'. Ant is supposed to start the jvm and
'forget' about it.

Steffen Schluff:
> there was a posting on this mailing list at the beginning of this year
> regarding this problem called "support for detached <exec> on Unix and
> Windows".
> You can find it at
> otherwise try Google with the term "antrunasync". There is a download on
> this page called which includes a script based ant extension
> solving this kinds of problems (for certain environments at least). It works
> fine for us maybe you want to give it a try.
> Here is sample showing how to start Tomcat the comments are german but
> you'll probably get the idea anyway :-)
> <project name="MyProject" default="main">
> 	<target name="main" >
> 		<tstamp/>
> 		<!-- antRunAsync Binaries muessen in %ANT_HOME%\bin liegen -->
> 		<property name="antRunAsync" value="C:\Java\ant-1.5.1\bin\antRunAsync"/>
> 		<property name="exec.dir"
> value="C:\Steffen\temp\Tomcat-4.1.12-LE-jdk14\bin"/>
> 		<property name="exec" value="${exec.dir}\startup.bat"/>
> 		<!-- Tomcat asynchron starten -->
> 		<echo message="Starting Tomcat"/>
> 		<exec executable="${antRunAsync}" dir="${exec.dir}" vmlauncher="false"
> failonerror="true">
> 			<arg line="${exec}"/>
> 		</exec>
> 		<echo message="Tomcat started"/>
> 		<!-- Ausfuehrung des Buildskripts unterbrechen bis Tomcat gestartet
> ist -->
> 		<!-- Ist Tomcat nicht in einer bestimmten Zeit per http erreichbar, -->
> 		<!-- wird der Buildvorgang mit einem Fehler abgebrochen -->
> 		<echo message="Waiting for Tomcat to be up and running"/>
> 		<waitfor timeoutproperty="tomcat.not.started"
> 			maxwait="30" maxwaitunit="second"
> 			checkevery="500" checkeveryunit="millisecond" >
> 			<http url="http://localhost:8080/index.jsp"/>
> 		</waitfor>
> 		<fail message="Unable to reach Tomcat" if="tomcat.not.started"/>
> 		<echo message="Tomcat appears to be up and running"/>
> 	</target>
> </project>

Jens Skripczynski
E-Mail: skripi-lists(at)myrealbox(dot)com

In this world there are only two tragedies; one is not getting
what one wants, the other is getting it.
                                  -- Oscar Wild

View raw message