You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by James Kennard <ja...@webamoeba.co.uk> on 2010/02/20 00:52:49 UTC

Include Macros Defined in a Single Directory

Hi,

I have been defining macros in individual files and as a result every 
time I add a new macro I am adding an import to a "import all macros" 
type file. Because I store all the macros in one directory, is it 
possible to import all the files located in this directory without the 
need to maintain a "import all macros" type file?

I appreciate there are some good reasons not to always import all the 
macros, but I am only looking at doing this for relatively simple build 
scripts (Canoo WebTests to be precise).

thanks :)

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


RE: Include Macros Defined in a Single Directory

Posted by Adam Peck <Ad...@smarttech.com>.
If it does not support fileset that means you are using a version earlier than 1.8.0. If you use ant-contrib you can do this:

<for param="import.file">
	<path>
		<fileset dir="macrosDirectory" includes="**/*.xml" />
	</path>
	<sequential>
		<import file="@{import.file}" />
	</sequential>
</for>

-Adam

-----Original Message-----
From: James Kennard [mailto:james@webamoeba.co.uk] 
Sent: Sunday, February 21, 2010 4:11 AM
To: Ant Users List
Subject: Re: Include Macros Defined in a Single Directory

Hi Matt thanks for the suggestion.

Unfortunately import does not appear to support the <fileset> type. When 
running this I get the following error: "import doesn't support the 
nested fileset element". I had another hunt around the internet and 
found a solution (have yet to try it but it looks like it should work). 
For anyone who is interested take a look at Question 17 at 
http://wiki.apache.org/ant/AntNewbies

james.

Matt Benson wrote:
> Ant 1.8.0 shipped with the ability to nest any resourcecollection into 
> your import task:
>
> <import>
>   <fileset dir="macrosDirectory" />
> </import>
>
> Should work for you.
>
> -Matt
>
> On Feb 19, 2010, at 5:52 PM, James Kennard wrote:
>
>> Hi,
>>
>> I have been defining macros in individual files and as a result every 
>> time I add a new macro I am adding an import to a "import all macros" 
>> type file. Because I store all the macros in one directory, is it 
>> possible to import all the files located in this directory without 
>> the need to maintain a "import all macros" type file?
>>
>> I appreciate there are some good reasons not to always import all the 
>> macros, but I am only looking at doing this for relatively simple 
>> build scripts (Canoo WebTests to be precise).
>>
>> thanks :)
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
> ---
> avast! Antivirus: Inbound message clean.
> Virus Database (VPS): 100220-1, 20/02/2010
> Tested on: 21/02/2010 10:31:42
> avast! - copyright (c) 1988-2010 ALWIL Software.
> http://www.avast.com
>
>
>
>


---------------------------------------------------------------------
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: Include Macros Defined in a Single Directory

Posted by "Dalton, Tom" <td...@hp.com>.
Are you using Ant 1.8.0?

Tom 

-----Original Message-----
From: James Kennard [mailto:james@webamoeba.co.uk] 
Sent: 21 February 2010 11:11
To: Ant Users List
Subject: Re: Include Macros Defined in a Single Directory

Hi Matt thanks for the suggestion.

Unfortunately import does not appear to support the <fileset> type. When running this I get the following error: "import doesn't support the nested fileset element". I had another hunt around the internet and found a solution (have yet to try it but it looks like it should work). 
For anyone who is interested take a look at Question 17 at http://wiki.apache.org/ant/AntNewbies

james.

Matt Benson wrote:
> Ant 1.8.0 shipped with the ability to nest any resourcecollection into 
> your import task:
>
> <import>
>   <fileset dir="macrosDirectory" />
> </import>
>
> Should work for you.
>
> -Matt
>
> On Feb 19, 2010, at 5:52 PM, James Kennard wrote:
>
>> Hi,
>>
>> I have been defining macros in individual files and as a result every 
>> time I add a new macro I am adding an import to a "import all macros"
>> type file. Because I store all the macros in one directory, is it 
>> possible to import all the files located in this directory without 
>> the need to maintain a "import all macros" type file?
>>
>> I appreciate there are some good reasons not to always import all the 
>> macros, but I am only looking at doing this for relatively simple 
>> build scripts (Canoo WebTests to be precise).
>>
>> thanks :)
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
> ---
> avast! Antivirus: Inbound message clean.
> Virus Database (VPS): 100220-1, 20/02/2010 Tested on: 21/02/2010 
> 10:31:42 avast! - copyright (c) 1988-2010 ALWIL Software.
> http://www.avast.com
>
>
>
>


---------------------------------------------------------------------
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: Include Macros Defined in a Single Directory

Posted by James Kennard <ja...@webamoeba.co.uk>.
Hi Matt thanks for the suggestion.

Unfortunately import does not appear to support the <fileset> type. When 
running this I get the following error: "import doesn't support the 
nested fileset element". I had another hunt around the internet and 
found a solution (have yet to try it but it looks like it should work). 
For anyone who is interested take a look at Question 17 at 
http://wiki.apache.org/ant/AntNewbies

james.

Matt Benson wrote:
> Ant 1.8.0 shipped with the ability to nest any resourcecollection into 
> your import task:
>
> <import>
>   <fileset dir="macrosDirectory" />
> </import>
>
> Should work for you.
>
> -Matt
>
> On Feb 19, 2010, at 5:52 PM, James Kennard wrote:
>
>> Hi,
>>
>> I have been defining macros in individual files and as a result every 
>> time I add a new macro I am adding an import to a "import all macros" 
>> type file. Because I store all the macros in one directory, is it 
>> possible to import all the files located in this directory without 
>> the need to maintain a "import all macros" type file?
>>
>> I appreciate there are some good reasons not to always import all the 
>> macros, but I am only looking at doing this for relatively simple 
>> build scripts (Canoo WebTests to be precise).
>>
>> thanks :)
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
> ---
> avast! Antivirus: Inbound message clean.
> Virus Database (VPS): 100220-1, 20/02/2010
> Tested on: 21/02/2010 10:31:42
> avast! - copyright (c) 1988-2010 ALWIL Software.
> http://www.avast.com
>
>
>
>


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


Re: Include Macros Defined in a Single Directory

Posted by Matt Benson <gu...@gmail.com>.
Ant 1.8.0 shipped with the ability to nest any resourcecollection  
into your import task:

<import>
   <fileset dir="macrosDirectory" />
</import>

Should work for you.

-Matt

On Feb 19, 2010, at 5:52 PM, James Kennard wrote:

> Hi,
>
> I have been defining macros in individual files and as a result  
> every time I add a new macro I am adding an import to a "import all  
> macros" type file. Because I store all the macros in one directory,  
> is it possible to import all the files located in this directory  
> without the need to maintain a "import all macros" type file?
>
> I appreciate there are some good reasons not to always import all  
> the macros, but I am only looking at doing this for relatively  
> simple build scripts (Canoo WebTests to be precise).
>
> thanks :)
>
> ---------------------------------------------------------------------
> 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