james.javaman wrote:
Hi Dan,
Thanks for your response. Let me just make sure I heard you right:
So I have a javac target in my build.xml file. It simply compiles code in
${source} and puts it in {$build}. You are suggesting that I point {$build}
to the Tomcat directory?
For example, since I’m on Windows, {$build} might be:
C:\Program Files\Apache Software Foundation\Tomcat
6.0\webapps\myWebApplication\WEB-INF\classes
So lets say I’ve changed some of my servlet code. Could I then just do this
to see it reflected: ?
ant javac
ant reload
ant gui
Finally, is this the “official” (or good) way to do this? In other words,
this isn’t a “hack” or anything?
No you can keep ${build} where it is, as the javac command does not matter.
ant reload, if i recall the technical definition correctly, reloads the
context path of the web application. Therefore, rather than undeploying
your webapp and deploying it again to see the changes reflected when you
navigate to your webapp, you can call "ant reload" to reload the webapp
in Tomcat (yes I know it's not good practice to use the word you're
defining in the definition, but I don't know how else to put it). This
will "reflect" the changes.
This is certainly not a "hack", it's just a custom Ant task that you can
use with Tomcat, such as ant stop, ant start, ant deploy, etc.
I have a build.xml file I'm using for my webapp that uses reload. I have
it set up so if the compilation of my .java files is successful, it will
reload the webapp so I don't have to do it manually. Here is what the
relevant part of my build.xml file looks like:
<!-- Compile the .java files in the src directory and output to the
build directory -->
<target name="compile" depends="init">
<!-- Compile the java code -->
<javac srcdir="${src}" destdir="${build}" />
</target>
<!-- Reload the web application in Apache Tomcat to process changes -->
<target name="reload" depends="compile" description="Reload web
application">
<reload url="${url}" username="${username}"
password="${password}" path="${path}" />
</target>
Where ${url} is the URL of my manager webapp, ${username} and
${password} are the username and password for my manager webapp, and
${path} is the path of the webapp I am reloading
($CATALINA_HOME/webapps/myWebApp).
You can cause it to reload by typing:
ant reload
from the command line;
ant javac
is not needed.
Dan
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]