jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Stirling <sstirl...@allaire.com>
Subject [ PROPOSAL ] Ant taglib
Date Sat, 16 Dec 2000 04:29:29 GMT

The subject says a lot.  What I'm proposing here is an addition to the
taglib project.

I have a few of the easy tags implemented as prototypes all ready, namely:

<ant:echo message=""/>
<ant:fail message=""/>
<ant:gunzip src="/path/to/file.gz" dest="[ filename | directory ]"/>
<ant:gzip src="/path/to/file" zipfile="filename.zip"/>
<ant:mkdir dir="/directory(ies)/to/create"/>

So why the hell make a taglib out of Ant tasks, you ask?  I've thought about
it a lot.  The main reason I've thought of is that so many of the Ant tasks
make natural JSP tags that would allow people with Web scripting skills to
do a lot of the same mundane backend stuff that CFML tags do, that PERL
programmers scripts do, etc. such as copy files, delete files, ftp files,
execute native programs, and so on.  

Being able to build and deploy ejb jars and wars online would allow you to
easily make Web-based build systems.

Ant is a Jakarta project, and much of the task code from Ant could be
re-used.  So far I've written JSP tags that follow the semantics and
functionality of the Ant tasks, but throwing JspTagExceptions in place of
BuildExceptions, logging to ServletContext.log() and completely isolating
the individual tasks from the whole back end Ant build system with its
Project class and all its dependencies.

Since the Ant tasks would all be implemented as JSP tags, they could be
mixed with presentation tags, with scripting languages (via the BSF taglib),
and so on.

There are two main ways to do this that I've thought about, the latter of
which would depend on some cooperation/interaction with the Ant dev group:

1. Implement all the tasks as regular JSP tags in a taglib, capable of being
used in isolation (i.e., being able to use any task without having to nest
it in a project tag, or without requiring a Project to be instantiated,
etc.), just like any old tag.  Naturally some tags would be dependent on
each other, like fileset and include tags inside of the tags like copy and

2. Integrate the taglib with the Ant build system so that a build.xml could
(essentially) be run as a JSP page by simply changing its file extension to
.jsp, adding the appropriate taglib directive at the top and adding a tag
prefix to the XML tags.  This is pie in the sky, but an interesting goal, I
think.  And if Ant had a nice clean interface API for us, it would be easy
to tie into the whole Ant system from an app server without doing something
kludgey like using a Runtime.exec() or instantiating Ant's main() method.
Such an interface could also help with goal #1 above, allowing Ant tasks to
be instantiated as standalone entities (perhaps having Tags that implemented
an Ant Task interface).

I guess that's it.  I've been thinking about this for a couple weeks.  I
wanted to have more of the tags done before proposing this, but I really
wanted to get it off my chest.  I'd like to pursue this as an open source
project under the Jakarta Taglib project if you'll vote for it.

Best regards,

Scott Stirling
West Newton, MA

View raw message