Bug 17070 - The Catalina Ant tasks do not allow for 'reusable' build scripts
Summary: The Catalina Ant tasks do not allow for 'reusable' build scripts
Status: RESOLVED DUPLICATE of bug 10225
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 4.1.8
Hardware: All All
: P3 enhancement with 3 votes (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-14 04:33 UTC by Richard Kennard
Modified: 2010-12-14 19:34 UTC (History)
0 users



Attachments
Added a 'ignoreFailure' flag to prevent Ant tasks stopping the build (11.51 KB, patch)
2003-03-06 22:59 UTC, Richard Kennard
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Kennard 2003-02-14 04:33:48 UTC
Dear Sir/Madam,

The 'accepted' approach to building and installing WARs using the Catalina Ant 
tasks, after first starting Tomcat, is...

<taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/>

<install url="${tomcat.manager}"
            username="${tomcat.username}"
            password="${tomcat.password}"
            path="/${tomcat.app}"
            war="file://${builddir}/myapp.war"/>

...however this will FAIL on subsequent builds (without restarting Tomcat) with 
an 'application already installed' BuildException, so the subsequent 'accepted' 
approach is...

<taskdef name="install" classname="org.apache.catalina.ant.RemoveTask"/>
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/>

<remove url="${tomcat.manager}"
            username="${tomcat.username}"
            password="${tomcat.password}"
            path="/${tomcat.app}"/>

<install url="${tomcat.manager}"
            username="${tomcat.username}"
            password="${tomcat.password}"
            path="/${tomcat.app}"
            war="file://${builddir}/myapp.war"/>

It should be noted that, equally, this latter approach will FAIL the first time 
in (with a 'no application to remove' BuildException).

Having to toggle between these two approaches every 'development session' (the 
former the first time in, the latter all subsequent times before restarting 
Tomcat) is very unproductive.

None of the 'accepted' docs seem to address this problem, so either I am being 
an idiot (very possible :) or we could really do with a, say, 'ignoreFailure' 
parameter in AbstractCatalinaTask (that simply catches the Exception, logs it, 
but does not stop the build for it).

That way we could use the latter build script every time, making things much 
easier for us all :)

Many thanks for your time,
Comment 1 Richard Kennard 2003-02-14 04:35:17 UTC
(sorry - I messed up my 'taskdefs' in the second Ant script, but it doesn't 
change the problem)
Comment 2 Richard Kennard 2003-03-06 02:52:08 UTC
No response from anybody? Just to encourage you, I've implemented this (very 
simple) change in my own build scripts and it really is very beneficial...
Comment 3 Ronald Klop 2003-03-06 10:15:43 UTC
Than why don't you attach a patch to this bugreport? 
Comment 4 Richard Kennard 2003-03-06 22:59:03 UTC
Created attachment 5190 [details]
Added a 'ignoreFailure' flag to prevent Ant tasks stopping the build
Comment 5 Richard Kennard 2003-03-06 23:01:21 UTC
Wow - excuse my ignorance in not knowing I was meant/able to do this (I hope 
your comment wasn't meant harshly?).

I have, as instructed, attached a new version of AbstractCatalinaTask that I 
have found to be useful in my own builds. There will, of course, still need 
some docs to be updated (if, indeed, you approve my change).
Comment 6 Ronald Klop 2003-03-06 23:44:12 UTC
No, my comment wasn't meant harshly. Just a question. Little short maybe. 
But I don't have commit rights, so I can't do anything with it, but there are other ant 
developers out there who do these things and the chance is much bigger they do 
something with a bug report with a patch attached, than one without. :-) 
Comment 7 Mark Thomas 2010-12-14 19:34:58 UTC

*** This bug has been marked as a duplicate of bug 10225 ***