You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jon Stevens <la...@gmail.com> on 2010/06/25 05:44:22 UTC

Union + Tar

I've got my class which extends Union typedef. Inside of it are a bunch of
FileList's which in turn have a bunch of FileResources.

    <sunion id="all.classpath" scope="all">
        <sfilelist dir="${lib.dir}">
            <sfile name="${activation.jar}" scope="compile" />
        </sfilelist>
    </sunion>

Now, I'd like to reference that Union within a <tarfileset>... something
like this:

        <tar destfile="${target.dir}/${project.name}.tgz" compression="gzip"
longfile="gnu">
            <tarfileset prefix="lib">
                <resources refid="all.classpath" />
            </tarfileset>
        </tar>

I'm getting this error (ant 1.8.1):

only single argument resource collections are supported as archives

Idea's? One workaround is to create the directory structure first by copying
files, but that is kind of lame. =)

        <copy todir="${target.dir}/dist/lib">
           <union refid="all.classpath" />
        </copy>

jon

Re: Union + Tar

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-06-25, Jon Stevens wrote:

> mind if i submit a diff to the tar documentation page with this
> example?

Please do

Stefan

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


Re: Union + Tar

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-06-25, Jon Stevens wrote:

> Ok, how do I do the same thing with the war task lib directory?

> <war>
>    <lib>
>         need to put a reference to my union in here.
>    </lib>
> </war>

put a <mappedresources> that looks just the same as the one you've put
into <tar> where you now have your <lib> element.  The globmapper's to
should be WEB-INF/lib/* - that should be all.

Stefan

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


Re: Union + Tar

Posted by Jon Stevens <la...@gmail.com>.
Ok, how do I do the same thing with the war task lib directory?

<war>
   <lib>
        need to put a reference to my union in here.
   </lib>
</war>

jon


On Fri, Jun 25, 2010 at 9:47 AM, Jon Stevens <la...@gmail.com> wrote:

> sweet. works like a charm (even though it is a bit non-intuitive). mind if
> i submit a diff to the tar documentation page with this example?
>
> jon
>
>
> On Thu, Jun 24, 2010 at 9:10 PM, Stefan Bodewig <bo...@apache.org>wrote:
>
>> On 2010-06-25, Jon Stevens wrote:
>>
>> > Now, I'd like to reference that Union within a <tarfileset>... something
>> > like this:
>>
>> >         <tar destfile="${target.dir}/${project.name}.tgz"
>> compression="gzip"
>> > longfile="gnu">
>> >             <tarfileset prefix="lib">
>> >                 <resources refid="all.classpath" />
>> >             </tarfileset>
>> >         </tar>
>>
>> > I'm getting this error (ant 1.8.1):
>>
>> > only single argument resource collections are supported as archives
>>
>> To <tarfileset> a nested resource defines the tar archive to read
>> TarResources from.
>>
>> IIUC this is not what you want, you are using tarfileset because of the
>> prefix attribute, right?  If so, use <mappedresources> instead.
>>
>>         <tar destfile="${target.dir}/${project.name}.tgz"
>>              compression="gzip" longfile="gnu">
>>              <mappedresources>
>>                 <resources refid="all.classpath" />
>>                 <globmapper from="*" to="lib/*"/>
>>             </mappedresources>
>>         </tar>
>>
>> Stefan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>> For additional commands, e-mail: dev-help@ant.apache.org
>>
>>
>

Re: Union + Tar

Posted by Jon Stevens <la...@gmail.com>.
sweet. works like a charm (even though it is a bit non-intuitive). mind if i
submit a diff to the tar documentation page with this example?

jon


On Thu, Jun 24, 2010 at 9:10 PM, Stefan Bodewig <bo...@apache.org> wrote:

> On 2010-06-25, Jon Stevens wrote:
>
> > Now, I'd like to reference that Union within a <tarfileset>... something
> > like this:
>
> >         <tar destfile="${target.dir}/${project.name}.tgz"
> compression="gzip"
> > longfile="gnu">
> >             <tarfileset prefix="lib">
> >                 <resources refid="all.classpath" />
> >             </tarfileset>
> >         </tar>
>
> > I'm getting this error (ant 1.8.1):
>
> > only single argument resource collections are supported as archives
>
> To <tarfileset> a nested resource defines the tar archive to read
> TarResources from.
>
> IIUC this is not what you want, you are using tarfileset because of the
> prefix attribute, right?  If so, use <mappedresources> instead.
>
>         <tar destfile="${target.dir}/${project.name}.tgz"
>              compression="gzip" longfile="gnu">
>              <mappedresources>
>                 <resources refid="all.classpath" />
>                 <globmapper from="*" to="lib/*"/>
>             </mappedresources>
>         </tar>
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

Re: Union + Tar

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-06-25, Jon Stevens wrote:

> Now, I'd like to reference that Union within a <tarfileset>... something
> like this:

>         <tar destfile="${target.dir}/${project.name}.tgz" compression="gzip"
> longfile="gnu">
>             <tarfileset prefix="lib">
>                 <resources refid="all.classpath" />
>             </tarfileset>
>         </tar>

> I'm getting this error (ant 1.8.1):

> only single argument resource collections are supported as archives

To <tarfileset> a nested resource defines the tar archive to read
TarResources from.

IIUC this is not what you want, you are using tarfileset because of the
prefix attribute, right?  If so, use <mappedresources> instead.

         <tar destfile="${target.dir}/${project.name}.tgz"
              compression="gzip" longfile="gnu">
             <mappedresources>
                 <resources refid="all.classpath" />
                 <globmapper from="*" to="lib/*"/>
             </mappedresources>
         </tar>

Stefan

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