ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <>
Subject Re: Antlib... when?
Date Sun, 05 Jan 2003 16:08:54 GMT
Nicola Ken Barozzi wrote:

>> Nicola - you can just use taskdef with a resource parameter and define
>> all the cents at once.
> Yup, but you still have to do it.
> I want to simply make the user add a <centipede/> tag in the buildfile,
> but since it's not loaded, it cannot load others the way you say...
> catch22.

<project xmlns:cent="... " >

Sounds simple enough.

 <antlib name="org.krysalis.cents..."/>

One line (or ns ) describing the fact that the build file is using centipede
is not too much to ask.

BTW, centipede can define aditional antlibs if it wants ( I think it would
be better to require the user to declare all libs it uses - like in XSTL or 
JSP - but it's your choice on what centipede does ).

> I need something to load automatically, or I'll have something like this:
>      <import file="${ant.home}/src/core/xbuild.xml"/>
>      <taskdef file="${ant.home}/src/core/"/>
> I have now made a Centipede task, but the best I can do is:
>      <taskdef file="${ant.home}/src/core/"/>
>      <centipede/> <!-- does the import -->
> After that I can import the "cents", but only after that.
>> Conor has a very good point - if you look at a buildfile you should
>> be able to tell what antlibs it is using.
> If they are non-core I agree. But let me define what is core.
> As Java can import anything and not use "namespace" on every class name
> with explicit import.

But you still need to do an explicit


The only thing that is imported by default is java.lang - which is quite
Antlib can do the same - either <antlib name="..."> or with xmlns.

>> If the build file doesn't specify what libs it needs - how could
>> you guess ? ( i.e. if a build is written under the assumption that
>> the antlibs exist already in ant/lib and no reference to the
>> name of the antlibs is made ).
> You are right, but I need to init the system. These "taglibs", that for
> us are cents, are downloaded by a task that we need to define. It would
> be nicer if it were already there. Not really necessary, but much nicer.

You just need to declare that you use centipede and add one extra line
( <cent:centipede> or <cent:init> ). 
Maybe nicer without that - but not cleaner. 

I see no problem with including an downloader in antlib - as Conor sugested.
But that's a different issue.

> I have worked with XML a lot, in Cocoon and now Forrest.
> Namespaces are ugly, hard to declare and make the xml files unreadable.
> Ant buildfiles are nice also because they don't use namespaces. Please,
> let's resort to them only if *really* necessary.

I agree. If you don't have name conflicts - you can just use 
  <antlib name="URL" />

If you have conflicts - or just like the ns syntax - you use it.

The best of both worlds.
> You don't normally use full packagename of the classes in your java
> files, don't you?

You do need to do the "import package.*". For ant we can have 2 choices: 
either in xmlns or an explicit antlib with the URL.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message