Hi,

In our case we wanted to make an enhancement to one of the existing ant
tasks. Here is what we did:
- subclassed the existing implementation
- Loaded new implementation using taskdef
- use presetdef to redirect the standard implementation to our
implementation.

No need to modify all the existing calls and I can remove my changes by
deleting a few lines in the build.xml file:

<taskdef resource="my.properties" classpath="my.jar"
uri="http://my.com/"; loaderRef="my"/>

<presetdef name="jar">
        <my:jar/>
</presetdef>

Michael

-----Original Message-----
From: Ninju Bohra [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 28, 2005 2:39 PM
To: [email protected]
Subject: Getting my own core task implementation ahead of ant.jar

Hello all,
 
I am using ANT 1.6.2 on WinXP and Lunix enviroments...
 
I have some issues with the <sql> task (defined by the class
org.apache.tools.ant.taskdefs.SQLExec) in ant.jar (i.e. does not handle
PL/SQL, no interactive error handling, etc...) and have made suggestions
to the ant-dev group as to how to resolve them.
 
But while waiting for the ant-dev to resolve and agree on a solution, I
wanted to modify my local ant environment to have contain my desired
behavior.  Our first solution was to get the ANT source and modify the
default defintion of the <sql> task.  After rebuilding the ant.jar
everything worked but I felt uncomfortable that I had rebuilt and
changed the ANT distribution source and so I unable to move up the next
release (without having to re-do my code changes).
 
Then I came up with the idea that maybe if I could put my modified <sql>
task in a seperate jar and have that jar file (i.e. myTasks.jar), which
has my <sql> task (same package and class name) implementation, be
loaded before the core <sql> task then my <sql> would be used in place
of the core ANT one.  And if and when the ant-dev group gets around to
implementing some of my suggestions in the core <sql> task, all I need
to do is remove my class from my jar file and I will auto-magically pick
up the core <sql> task class.
 
Which comes to my core question, is this possible... and if so how/where
do I list my jar infront of ant.jars on both the WinXP enviroment
(ant.bat, ant.cmd, antRun.bat) and the Lunix/UNIX enviroments (ant and
antrun)?
 
I am also open to other ways to solve the problem of getting a custom
implementation while still using the standard task name in my build.xml
files?  I did not want to create my own task name (i.e. <MYsql>) and use
the <taskdef> to point to my custom implementation (with different
package or class name) because then I would make a lot of changes
if/when I moved back to the updated core task (i.e. <sql>).
 
I know that is way to wordy, but thanks for your input in advance,
 
Ninju Bohra

                
---------------------------------
Do you Yahoo!?
 Meet the all-new My Yahoo! - Try it today! 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to