Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Ant custom tasks: how to compile .java files and restart Tomcat (Tomcat
6.0.9)?

Daniel Gresh

2007-02-27

Replies:

Hi all,

I've been reading through the documentation on using custom Ant tasks
with Tomcat, but I am sorry to say that I am confused. This will most
likely turn out to be a very basic question, but I'm not sure where to
go with it.

I have a src directory for my .java files that I wish to compile to
.class files and simply store them on $CATALINA_HOME/webapps/ROOT for
now. I have a build.xml file in the src directory which I have been
using to deploy the class files to the appropriate directory.

My question is, how would I use Ant custom tasks to restart Tomcat when
I deploy the class files (please continue reading, as I will explain
where I am confused)?

Looking at the manager-howto, I see there are custom tasks for Deploy,
Reload, Start, Stop, etc that I should place in the build.xml file. I am
unsure how to use these to restart Tomcat. For example, the Reload task
looks like this:

<target name="reload" description="Reload web application"
      depends="compile">
  <reload url="${url}" username="${username}" password="${password}"
       path="${path}"/>
</target>

What would I specify for ${path}? In the example file provided in the howto, it says I should specify it to be myApp. However, I am not necessarily restarting an app; I wish to restart Tomcat.

Is it even possible to accomplish this? Did I miss something in the tutorial? If this is not possible, is there a better way I could be doing this? The reason I am compiling .java files and deploying them is simply to test a few things, as I am in the process of learning JSP and Tomcat.

Thanks for any advice you can give,
Dan



---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.