Tom Pierce's Blog : Let the geek times roll.
Updated: 6/20/04; 3:18:38 PM.

 

Subscribe to "Tom Pierce's Blog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Thursday, September 4, 2003

Apparently, Ant doesn't allow you to run exec tasks asynchronously. For example, if you start up Tomcat from an Ant build file, it will wait until Tomcat exits before it continues to work through its build file. This is probably not what you want it to do. You probably want it to spawn Tomcat in a new process and keep on trucking (or wait until Tomcat is up and then keep on trucking).

It seems to me this would be easy in Unix with a decent command shell. However, I'm in Windoze. So, no luck there.

But, I found a great thread (ala Google) that gives you a couple of options. I went with the "antRunAsync" option. Worked like a charm! Here's my Tomcat start target:


 <target name="start.tomcat" depends="prepare" if="tomcat-needs-to-start">
  <exec executable="cmd.exe" vmlauncher="false" failonerror="true">
   <env key="PATH" path="C:/WINNT/system32;C:/WINNT;C:/Program Files/SQLLIB/BIN;C:/Program Files/SQLLIB/FUNCTION;C:/Program Files/SQLLIB/SAMPLES/REPL;C:/Program Files/SQLLIB/HELP;C:/PROGRA~1/IBM/IMNNQ"/>
   <arg value="/c ${ant.home}/bin/antRunAsync ${websrv.dir}/bin/startup.bat"/>
  </exec>

  <waitfor>
   <http url="${testurl}"/>
  </waitfor>
 </target>

5:32:43 PM    comment []

I've been to battle.  My foe is my web application built around Struts 1.1 that I'm deploying on Tomcat 4.1.  I want Tomcat to be able to remove the application completely so that I can redeploy it without having to restart my server.  Tomcat patently rerfuses to delete the application's directory under "webapps" because the struts.jar in my WEB-INF/lib directory is being used.  Used by what?  I don't know.

I have emerged victorious.  How?  Instead of trying to actually remove or undeploy, I decided to just stop the web application, unwar my war on top of the Tomcat deploy directory, and start the web application again.  This seems to be a pretty decent work around to the locked struts.jar problem.

I'm automating all this with Tomcat's Ant tasks.   Booyah!

4:06:27 PM    comment []

Did you know that you can have Ant deploy your application to Tomcat 4.1 and automagically deploy/undeploy the application?  This prevents you from having to restart Tomcat after a deploy if you've changed the web.xml or other non-reloaded properties.  Here's the link to the documentation.

1:32:28 PM    comment []

Want to get your hands on an Ant DTD?  Why not have Ant generate it for you?  Check out this article.

1:30:15 PM    comment []

© Copyright 2004 Tom Pierce.



Click here to visit the Radio UserLand website.

 


September 2003
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Aug   Oct

Search

[sgl dagger]
How this works

Emacs Sources
 tsql-indent.el
 user-add-sql-folding-marks
 remove-line-boundary-in-region
 convert-camel-to-underscore

My Subscriptions
 Funny
 KM