Hi Dan,
Sorry if I’m being dense here, but how does the newly compiled code get into
$CATALINA_HOME/webapps/myWebApp?
I don’t see the part in your build.xml where the new changes (newly compiled
changes) make it to the Tomcat directory.
According to your response, ${build} can point anywhere. I mean, lets say
${build} points to: C:\temp\nowhere_of_significance. Wouldn’t this mess up
a reload? The only parameters I see in a reload are a username, password, a
manager url and path of the tomcat web app. Won’t this just reload the same
thing (without our new change.) Is there something happening "under the
hood" I just can't see here where the compiled code magically gets put into
the Tomcat directory?
Thanks for your patience.
Daniel Gresh wrote:
>
> 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: [email protected]
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Example-of-a-build.xml-File-for-Tomcat---tf3404338.html#a9483268
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]