You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Matt Benson <gu...@gmail.com> on 2010/01/28 19:47:50 UTC

Re: Add new resource to existing ResourceCollection (path) in ANT build script

On Jan 28, 2010, at 12:21 PM, Dan Beaulieu wrote:

>
>
> I've got a build script that builds multiple components and jars them
> up. I currently build a path like so:
>
> <path id="project.class.basepath">
>     <fileset dir="${lib.dir}">
>         <include name="**/*.jar" />
>     </fileset>
>   <fileset dir="${path.to.base}/components">
>         <include name="*/build/lib/*.jar" />
>     </fileset>
> </path>
>
> And this gets called before every compile target. So every time, its
> loading everything in the /lib dir and then scanning all of the
> components for jars.
>
> I'd like to just add to this path after I jar each component, So I'd
> have:
>
> <jar....>
> .
> .
> </jar>
> <path id="project.class.basepath">
>     <path refid="project.class.basepath"/>
>     <fileset dir="${path.to.base}/components/${component}">
>         <include name="*${build.dir}/lib/*.jar" />
>     </fileset>
> </path>
>
> But that doesn't work, with circular dependency failures.
>
> I also tried make a temp path with a different name first, but that  
> did
> not work either with the same message.
>
> My main problem doing it as I currently am, is it's scanning all of  
> the
> components (27 of them) every time for jars, when I really only  
> want to
> add in the last one we just built, and I know when and where we are
> doing it so why not there?
>
> Anyway to update a path reference instead of stomping it and  
> rebuilding
> it completely?

I would think the correct way to do this would be to design a task  
that would use Ant's built-in facilities to augment a given ref  
object with attributes and nested elements, but such is not trivial.   
In the meantime you could/should probably script something like this.

HTH,
Matt

>
> ---------------------------------------------------------------------
> 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: Add new resource to existing ResourceCollection (path) in ANT build script

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hello Dan,

what you would write is something like that :

<addpath topath="project.class.basepath">
	<path>
            <pathelement="a/b/c/some.jar"/>
            <fileset dir="foo" includes="*.jar"/>
      </path>
</addpath>

In other words, the macrodef element <nested/> can be replaced by
anything which can fit inside a path.

Regards,

Antoine


Dan Beaulieu wrote:
> Err, I'm not entirely new to ant, but I don't understand how to use this. Any further explanation would be appreciated!
>
> <addpath topath="project.class.basepath">
> 	<nested>
>       ...
>       </nested>
> </addpath>
>
> -----Original Message-----
> From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
> Sent: Friday, January 29, 2010 12:38 AM
> To: user@ant.apache.org
> Subject: AW: Add new resource to existing ResourceCollection (path) in ANT build script
>
> I have an implementation for <path>s: copy to a temporary and then 'rename'
>
>     <macrodef name="addpath">
>         <attribute name="topath"/>
>         <element name="nested" optional="yes" implicit="true"/>
>         <sequential>
>             <path id="tmp">
>               <pathelement path="${toString:@{topath}}"/>
>               <nested/>
>             </path>
>             <path id="@{topath}"><pathelement path="${toString:tmp}"/></path>
>             <path id="tmp"/>
>         </sequential>
>     </macrodef>
>
>
> Jan 
>
>   
>> -----Ursprüngliche Nachricht-----
>> Von: Matt Benson [mailto:gudnabrsam@gmail.com] 
>> Gesendet: Donnerstag, 28. Januar 2010 19:48
>> An: Ant Users List
>> Betreff: Re: Add new resource to existing ResourceCollection 
>> (path) in ANT build script
>>
>>
>> On Jan 28, 2010, at 12:21 PM, Dan Beaulieu wrote:
>>
>>     
>>> I've got a build script that builds multiple components and 
>>>       
>> jars them 
>>     
>>> up. I currently build a path like so:
>>>
>>> <path id="project.class.basepath">
>>>     <fileset dir="${lib.dir}">
>>>         <include name="**/*.jar" />
>>>     </fileset>
>>>   <fileset dir="${path.to.base}/components">
>>>         <include name="*/build/lib/*.jar" />
>>>     </fileset>
>>> </path>
>>>
>>> And this gets called before every compile target. So every time, its 
>>> loading everything in the /lib dir and then scanning all of the 
>>> components for jars.
>>>
>>> I'd like to just add to this path after I jar each component, So I'd
>>> have:
>>>
>>> <jar....>
>>> .
>>> .
>>> </jar>
>>> <path id="project.class.basepath">
>>>     <path refid="project.class.basepath"/>
>>>     <fileset dir="${path.to.base}/components/${component}">
>>>         <include name="*${build.dir}/lib/*.jar" />
>>>     </fileset>
>>> </path>
>>>
>>> But that doesn't work, with circular dependency failures.
>>>
>>> I also tried make a temp path with a different name first, but that 
>>> did not work either with the same message.
>>>
>>> My main problem doing it as I currently am, is it's scanning all of 
>>> the components (27 of them) every time for jars, when I really only 
>>> want to add in the last one we just built, and I know when and where 
>>> we are doing it so why not there?
>>>
>>> Anyway to update a path reference instead of stomping it and 
>>> rebuilding it completely?
>>>       
>> I would think the correct way to do this would be to design a 
>> task that would use Ant's built-in facilities to augment a given ref  
>> object with attributes and nested elements, but such is not trivial.   
>> In the meantime you could/should probably script something like this.
>>
>> HTH,
>> Matt
>>
>>     


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


RE: Add new resource to existing ResourceCollection (path) in ANT build script

Posted by Dan Beaulieu <db...@moreover.com>.
Err, I'm not entirely new to ant, but I don't understand how to use this. Any further explanation would be appreciated!

<addpath topath="project.class.basepath">
	<nested>
      ...
      </nested>
</addpath>

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
Sent: Friday, January 29, 2010 12:38 AM
To: user@ant.apache.org
Subject: AW: Add new resource to existing ResourceCollection (path) in ANT build script

I have an implementation for <path>s: copy to a temporary and then 'rename'

    <macrodef name="addpath">
        <attribute name="topath"/>
        <element name="nested" optional="yes" implicit="true"/>
        <sequential>
            <path id="tmp">
              <pathelement path="${toString:@{topath}}"/>
              <nested/>
            </path>
            <path id="@{topath}"><pathelement path="${toString:tmp}"/></path>
            <path id="tmp"/>
        </sequential>
    </macrodef>


Jan 

>-----Ursprüngliche Nachricht-----
>Von: Matt Benson [mailto:gudnabrsam@gmail.com] 
>Gesendet: Donnerstag, 28. Januar 2010 19:48
>An: Ant Users List
>Betreff: Re: Add new resource to existing ResourceCollection 
>(path) in ANT build script
>
>
>On Jan 28, 2010, at 12:21 PM, Dan Beaulieu wrote:
>
>>
>>
>> I've got a build script that builds multiple components and 
>jars them 
>> up. I currently build a path like so:
>>
>> <path id="project.class.basepath">
>>     <fileset dir="${lib.dir}">
>>         <include name="**/*.jar" />
>>     </fileset>
>>   <fileset dir="${path.to.base}/components">
>>         <include name="*/build/lib/*.jar" />
>>     </fileset>
>> </path>
>>
>> And this gets called before every compile target. So every time, its 
>> loading everything in the /lib dir and then scanning all of the 
>> components for jars.
>>
>> I'd like to just add to this path after I jar each component, So I'd
>> have:
>>
>> <jar....>
>> .
>> .
>> </jar>
>> <path id="project.class.basepath">
>>     <path refid="project.class.basepath"/>
>>     <fileset dir="${path.to.base}/components/${component}">
>>         <include name="*${build.dir}/lib/*.jar" />
>>     </fileset>
>> </path>
>>
>> But that doesn't work, with circular dependency failures.
>>
>> I also tried make a temp path with a different name first, but that 
>> did not work either with the same message.
>>
>> My main problem doing it as I currently am, is it's scanning all of 
>> the components (27 of them) every time for jars, when I really only 
>> want to add in the last one we just built, and I know when and where 
>> we are doing it so why not there?
>>
>> Anyway to update a path reference instead of stomping it and 
>> rebuilding it completely?
>
>I would think the correct way to do this would be to design a 
>task that would use Ant's built-in facilities to augment a given ref  
>object with attributes and nested elements, but such is not trivial.   
>In the meantime you could/should probably script something like this.
>
>HTH,
>Matt
>
>>
>> ---------------------------------------------------------------------
>> 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
>
>

---------------------------------------------------------------------
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


AW: Add new resource to existing ResourceCollection (path) in ANT build script

Posted by Ja...@rzf.fin-nrw.de.
I have an implementation for <path>s: copy to a temporary and then 'rename'

    <macrodef name="addpath">
        <attribute name="topath"/>
        <element name="nested" optional="yes" implicit="true"/>
        <sequential>
            <path id="tmp">
              <pathelement path="${toString:@{topath}}"/>
              <nested/>
            </path>
            <path id="@{topath}"><pathelement path="${toString:tmp}"/></path>
            <path id="tmp"/>
        </sequential>
    </macrodef>


Jan 

>-----Ursprüngliche Nachricht-----
>Von: Matt Benson [mailto:gudnabrsam@gmail.com] 
>Gesendet: Donnerstag, 28. Januar 2010 19:48
>An: Ant Users List
>Betreff: Re: Add new resource to existing ResourceCollection 
>(path) in ANT build script
>
>
>On Jan 28, 2010, at 12:21 PM, Dan Beaulieu wrote:
>
>>
>>
>> I've got a build script that builds multiple components and 
>jars them 
>> up. I currently build a path like so:
>>
>> <path id="project.class.basepath">
>>     <fileset dir="${lib.dir}">
>>         <include name="**/*.jar" />
>>     </fileset>
>>   <fileset dir="${path.to.base}/components">
>>         <include name="*/build/lib/*.jar" />
>>     </fileset>
>> </path>
>>
>> And this gets called before every compile target. So every time, its 
>> loading everything in the /lib dir and then scanning all of the 
>> components for jars.
>>
>> I'd like to just add to this path after I jar each component, So I'd
>> have:
>>
>> <jar....>
>> .
>> .
>> </jar>
>> <path id="project.class.basepath">
>>     <path refid="project.class.basepath"/>
>>     <fileset dir="${path.to.base}/components/${component}">
>>         <include name="*${build.dir}/lib/*.jar" />
>>     </fileset>
>> </path>
>>
>> But that doesn't work, with circular dependency failures.
>>
>> I also tried make a temp path with a different name first, but that 
>> did not work either with the same message.
>>
>> My main problem doing it as I currently am, is it's scanning all of 
>> the components (27 of them) every time for jars, when I really only 
>> want to add in the last one we just built, and I know when and where 
>> we are doing it so why not there?
>>
>> Anyway to update a path reference instead of stomping it and 
>> rebuilding it completely?
>
>I would think the correct way to do this would be to design a 
>task that would use Ant's built-in facilities to augment a given ref  
>object with attributes and nested elements, but such is not trivial.   
>In the meantime you could/should probably script something like this.
>
>HTH,
>Matt
>
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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