Chaitanya MSV
Chaitanya MSV

Reputation: 6784

Ant task to automate the start of my server and application

I want to write Ant task to automate the task of starting my server and then open Internet Explorer with the URL of my application.

Obviously I have to execute the startServer task first and then startApplication task.

But Ant is not coming out of startServer task even after starting the server to execute startApplication task.

Basically I want Ant to understand that startServer will not end and ANT has to come out of startServer task and runstartApplication task while startServer task is running in background.

Upvotes: 5

Views: 4704

Answers (3)

carej
carej

Reputation:

You also need to be aware of the problems with exec'ing .bat files directly. Consult the manual page for the <exec> task for more information.

Upvotes: 0

John McG
John McG

Reputation: 698

I agree with Aaron you can use exec to do this, you can also use waitfor to test your connection.

<exec executable="${jboss.startup.bat}" spawn="true"/>
<echo>Waiting to start</echo>
<waitfor maxwait="10" maxwaitunit="second" checkevery="5000">
<!-- try to detect when the server has started -->
    <http url="${myurl}" />
</waitfor>
<echo>Started</echo>

Upvotes: 2

Aaron Digulla
Aaron Digulla

Reputation: 328594

My guess is that you have an exec task in startServer. Add spawn="true" to the exec. Ant will then execute the command in the background and continue without waiting for it to complete.

Upvotes: 3

Related Questions