You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Hiran Chaudhuri <hi...@gmx.net> on 2022/08/19 05:39:20 UTC

Bundling Ant Tasks

Hello there.

I successfully created several custom Ant Tasks myself, thanks to the
fine documentation in https://ant.apache.org/manual/developlist.html

Now when I want to use these tasks, I always have to use taskdef
elements in all my scripts and always remember exact dependencies
(classpath) or the class names of the tasks.

From other libraries I have seen there are things like property or XML
files bundled with the tasks that can host such information - but they
seem to be an undocumented feature?

How would I apply them correctly?

Hiran


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


Re: Bundling Ant Tasks

Posted by Stefan Bodewig <bo...@apache.org>.
On 2022-08-22, Hiran Chaudhuri wrote:

> If it is a bit buried but exists it might be nice to have a reference
> from the 'Developing with Ant' guide.

This is true.

Have you got any suggestion where and how to do that? Maybe even a blurb
of text that you could contribute given that you are freshly going
through the process of bundling your tasks?

Stefan

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


Re: Bundling Ant Tasks

Posted by Hiran Chaudhuri <hi...@gmx.net>.
That's what I was searching for, thank you. I shall try the documented
stuff. :-)


If it is a bit buried but exists it might be nice to have a reference
from the 'Developing with Ant' guide.

Hiran


On Fri, 2022-08-19 at 09:20 +0200, Stefan Bodewig wrote:
> On 2022-08-19, Hiran Chaudhuri wrote:
>
> > From other libraries I have seen there are things like property or
> > XML
> > files bundled with the tasks that can host such information - but
> > they
> > seem to be an undocumented feature?
>
> You are describing tasks bundled as an antlib. The documentation is a
> bit burried under "Concepts and Types".
>
> https://ant.apache.org/manual/Types/antlib.html
>
> What you do is to put your tasks in a jar file and add an XML file
> using
> the antlib format to it as well. If your file lives in
>
> com/example/tasks/antlib.xml
>
> inside the jar and it is on Ant's classpath then
>
> <project xmlns:my="antlib:com.example.tasks">
>
> will load your defintions and put them into the my XML namespace. If
> you
> want to avoid putting the jar in the classpath you can still use
> <typedef> as described in the last example in typedef's manual.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


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


Re: Bundling Ant Tasks

Posted by Stefan Bodewig <bo...@apache.org>.
On 2022-08-19, Hiran Chaudhuri wrote:

> From other libraries I have seen there are things like property or XML
> files bundled with the tasks that can host such information - but they
> seem to be an undocumented feature?

You are describing tasks bundled as an antlib. The documentation is a
bit burried under "Concepts and Types".

https://ant.apache.org/manual/Types/antlib.html

What you do is to put your tasks in a jar file and add an XML file using
the antlib format to it as well. If your file lives in

com/example/tasks/antlib.xml

inside the jar and it is on Ant's classpath then

<project xmlns:my="antlib:com.example.tasks">

will load your defintions and put them into the my XML namespace. If you
want to avoid putting the jar in the classpath you can still use
<typedef> as described in the last example in typedef's manual.

Stefan

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


Re: Bundling Ant Tasks

Posted by KM <in...@yahoo.com.INVALID>.
You should be able to set the properties in the calling ant script or in your environment file using variables.  Unfortunately it's been a while since I used Ant and can't remember exactly.   If they are values that don't change set them directly, otherwise the env variables or properties in a file. 

dependencies can be hard coded as well, from the Ant script calling the new task defs.

KM

On Friday, August 19, 2022 at 01:40:19 AM EDT, Hiran Chaudhuri <hi...@gmx.net> wrote: 





Hello there.

I successfully created several custom Ant Tasks myself, thanks to the
fine documentation in https://ant.apache.org/manual/developlist.html

Now when I want to use these tasks, I always have to use taskdef
elements in all my scripts and always remember exact dependencies
(classpath) or the class names of the tasks.

From other libraries I have seen there are things like property or XML
files bundled with the tasks that can host such information - but they
seem to be an undocumented feature?

How would I apply them correctly?

Hiran


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


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