managing optional tasks and dependencies with taskdef

4 views
Skip to first unread message

Brian FitzGerald

unread,
Oct 20, 2009, 10:33:07 PM10/20/09
to Ant4CF
Hey there,

I sat in on Doug's Ant preso at CFINNC and I'm having a bit of a snag,
not with Ant4CF persay, but with one of the concepts Doug presented in
his build. My problem is that I'm using Ant from within Eclipse
(CFBuilder) and whenever I need to reinstall eclipse or set it up on a
new system, I need to go track down my optional tasks all over again.
(i.e. tasks to manage FTP, SVN, etc.). It's a real pain.

In his presentation, Doug pointed out that you can avoid this hassle
by using the taskdef task, but the Ant documentation I read is not
making it clear to me how this works. The concept makes sense though,
basically you would store your jars in the directory structure of your
application rather than in your Eclipse/Ant install directory, so that
as you move your application around, or someone new grabs a fresh
local copy, they have everything they need without fishing.

The example in the Ant docs looks like this.
<taskdef name="myjavadoc" classname="com.mydomain.JavadocTask"/>

I guess the root of my confusion is the different directories I'm
looking at. There is the ECLIPSE_HOME\plugins directory, which
contains the ANT directory (seems like this is for plugins to eclipse
as directories or Jars). And then in the ant directory, there is the
ANT_HOME\lib directory. (seems like the normal place for the jars for
optional ant tasks)

So with that said, I try to prepare my taskdef like so:
<taskdef name="??" classname="commons-net-2.0.jar"/>

When I try to run this, an alert tells me it can't find the jar I
specified. I tried to put the jar in ANT_HOME\lib also in
ECLIPSE_HOME \plugins, and also just in the same file as my build.xml
- none worked.

How can I set this up properly so that I can keep my application fully
self contained including my optional ant tasks? Also, what should the
name of the task def be? I guess "ftp" for the one above because
commons-net-2.0.jar allows you to implement the ftp task.

Thanks for your thoughts,
Brian

Jim Priest

unread,
Nov 2, 2009, 1:15:47 PM11/2/09
to Ant4CF
On Oct 20, 9:33 pm, Brian FitzGerald <bmfitzgera...@gmail.com> wrote:
> (CFBuilder) and whenever I need to reinstall eclipse or set it up on a
> new system, I need to go track down my optional tasks all over again.
> (i.e. tasks to manage FTP, SVN, etc.).  It's a real pain.

While I run most of my Ant scripts through Eclipse I do have Ant
installed locally - and that is also where I copy all my additional
task jars. Then I simply setup Eclipse to use that version of Ant
instead of the 'built-in' Ant.

Two benefits:
1) I can run all the same tasks via command line
2) If I want to reinstall Eclipse, or run multiple Eclipse - I simply
point it to the same directory...

For more info: http://www.thecrumb.com/2008/10/14/configuring-eclipse-to-use-command-line-ant/

Jim

Reply all
Reply to author
Forward
0 new messages