You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jens Skripczynski <sk...@myrealbox.com> on 2003/05/07 00:20:12 UTC

make ant ignore forked thread

Hi,

I want to write a startup skript for tomcat in ant.

stopping works fine. But when I try to start ant, the
task keeps waiting for the server to shut down.

Is there some hidden option, where I can make ant to ignore
that a specific <java fork=yes> task is not finished ?

I found that I could use exec, but I would have all the OS specific
tasks (setup paths, find executeable java command,...), that ant all
does for me, when using <java>. So as far as I understand <exec>, it is 
not an option

I will attach my current start script. I hope someone has a hint.

Ciao

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

Wisdom comes with age, 
but sometimes age comes alone.


AW: make ant ignore forked thread

Posted by Steffen Schluff <sc...@oio.de>.
Hi Jens,

I know exactly what you when and definetly do agree with you (no need to use
shell scripting as workaround for a 'simple' java call).

But as far as I know there is currently no way to do this using 'pure' ant.
Unfortunately I'm not aware if this could easily implemented or if this
feature is planned respectively. Maybe someone else can comment on this?

Best regards

Steffen Schluff
Orientation in Objects GmbH
http://www.oio.de

-----Ursprungliche Nachricht-----
Von: Jens Skripczynski [mailto:skripi-lists@myrealbox.com]
Gesendet: Mittwoch, 7. Mai 2003 12:49
An: Steffen Schluff
Cc: user@ant.apache.org
Betreff: Re: make ant ignore forked thread


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
> http://www.mail-archive.com/ant-user@jakarta.apache.org/msg23641.html
> otherwise try Google with the term "antrunasync". There is a download on
> this page called ant_async.zip 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>
Ciao

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


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


Re: make ant ignore forked thread

Posted by Jens Skripczynski <sk...@myrealbox.com>.
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
> http://www.mail-archive.com/ant-user@jakarta.apache.org/msg23641.html
> otherwise try Google with the term "antrunasync". There is a download on
> this page called ant_async.zip 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>
Ciao

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


AW: make ant ignore forked thread

Posted by Steffen Schluff <sc...@oio.de>.
Hello Jens,

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
http://www.mail-archive.com/ant-user@jakarta.apache.org/msg23641.html
otherwise try Google with the term "antrunasync". There is a download on
this page called ant_async.zip 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>

Best wishes,

Steffen Schluff
Orientation in Objects GmbH
http://www.oio.de


-----Ursprungliche Nachricht-----
Von: Jens Skripczynski [mailto:skripi-lists@myrealbox.com]
Gesendet: Mittwoch, 7. Mai 2003 00:20
An: user@ant.apache.org
Cc: Jens Skripczynski
Betreff: make ant ignore forked thread


Hi,

I want to write a startup skript for tomcat in ant.

stopping works fine. But when I try to start ant, the
task keeps waiting for the server to shut down.

Is there some hidden option, where I can make ant to ignore
that a specific <java fork=yes> task is not finished ?

I found that I could use exec, but I would have all the OS specific
tasks (setup paths, find executeable java command,...), that ant all
does for me, when using <java>. So as far as I understand <exec>, it is
not an option

I will attach my current start script. I hope someone has a hint.

Ciao

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

Wisdom comes with age,
but sometimes age comes alone.