ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 31999] - Easier way to declare externally-written tasks in build script
Date Mon, 22 Nov 2004 16:47:38 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31999>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31999





------- Additional Comments From kk@kohsuke.org  2004-11-22 17:47 -------
Thanks. It took me a while to figure out the new declaration mechanism.
(but I guess that's my fault --- Google found it quickly)

http://ant.apache.org/manual/CoreTypes/antlib.html

As of Ant 1.6.2, in the beginning of this document,
there's an example that says:

    For example, assuming that the sample.xml is in a jar file
    sample.jar also containing the classes, the following build
    fragment will define the if and scriptpathmapper  tasks/types
    and place them in the namespace uri samples:/acme.org.

      <typedef resource="org/acme/ant/sample.xml"
         uri="samples:/acme.org"/>

But the above sample doesn't specify where sample.jar resides,
and it seems to me that unless Ant is a mind-reader, I don't
see how it can find the jar files. Perhaps it's missing
"classpath" nested elements?

This looks good to me, but I think it can be simplified further
by having the default resource name (/META-INF/antlib.xml ?)
to load antlib.xml from, and allowing the antlib.xml to declare
the URI (just like taglib.) If it's difficult to expand the
typedef task to take this much default, it could be another task.

This would allow build script writers to just type the following:

  <antlibdef>
    <classpath>
      <pathelement path="lib/mytask.jar"/>
    </classpath>
  </antlibdef>

  <!-- the namespace URI of the task is defined by the task writer -->
  <mt:mytask xmlns:mt="http://kohsuke.org/ant/mytask"/>

... to define it.


One could also consider having a special treatment like "antlib:" namespace URI
--- for example, you can treat relative namespace URIs
to jar files as if the above declaration is done.
In this way, I only need to write:

  <mt:mytask xmlns="lib/mytask.jar"/>


Anyway, the point that I was trying to make was that as a task 
developer, I'm willing to spend more efforts on writing tasks
(e.g., adding xml file in a known location, making sure
Class-Path manifest entry points to all the libraries),
but as a build script writer, I'd like the declaration
to be as simple as possible. And the way I see it, the latter
can be simplified further.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message