1
votes

I have an ant script which does in the beginning some checks and then compiles the code and deploys it to the tomcat server. The script for the build-war-deploy process looks like this:

<target name="build-war-deploy" depends="clean-up,gwtc,check-settings" description="Package GWT app to web archive and deploy to web server">
<war basedir="${war.dir}" destfile="${deploy.dir}/${app.name}.war" webxml="${webinf.dir}/web.xml">
<!-- <include name="WEB-INF/**" /> -->
<webinf dir="${webinf.dir}/">
<include name="**/*.jar" />
</webinf>
</war>
</target>

This target works perfectly fine, meaning after running the ant script the application is indeed deployed on tomcat.

After the build-war-deploy target I need to do some cleanup processes and therefore I created some other targets and added an dependency to the build-war-deploy target so that it is being executed afterwards.

<target name="cleanup" depends="build-war-deploy" description="clean up processes">
<exec dir="./" executable="python" failonerror="true">
    <arg line="deploy_cleanup.py ${app.name}" />
</exec>
</target>

However, after the ant script executes the build-war-deploy target it stops and says that the build was successful. Does anyone know why it did not perform the last target?

build-war-deploy:
      [war] Building war: C:\Apache Tomcat\apache-tomcat-6.0.33\webapps\test.war
BUILD SUCCESSFUL
Total time: 2 minutes 22 seconds
1
Are you specifying a target on the command line and/or do you have a default target set in the buildfile? - martin clayton
all the targets are being specified in the buildfile. - mkn
Try running "ANT cleanup". I suspect the default target is "build-war-deploy" - Mark O'Connor
you are right. the build-war-deploy target is being set to default :S - mkn

1 Answers

1
votes

I would try using an outputproperty. Perhaps the python file is executing -- not doing what you want but executing and returning the results which you never see. I mean if the python script returns an error message, doesn't ant view that as successfully executing?

Something like:

<exec dir="./" executable="python"  outputproperty="outProp" failonerror="true">
    <arg line="deploy_cleanup.py ${app.name}" />
</exec>
<echo>${outProp}</echo>

outputproperty: The name of a property in which the output of the command should be stored. Unless the error stream is redirected to a separate file or stream, this property will include the error output.