You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by yitzle <yi...@users.sourceforge.net> on 2007/05/29 18:01:17 UTC

zipfileset dir vs src

I am trying to add a single file to a jar.

This works:
<zipfileset dir="${src}" prefix="WEB-INF" includes="web.xml" />

This gives an error about not being able to access the file:
<zipfileset src="${src}/web.xml" prefix="WEB-INF" />

Am I doing something wrong with the src?

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


Re: zipfileset dir vs src

Posted by yitzle <yi...@users.sourceforge.net>.
Thanks. I had misinterpreted it. That clears it up!

On 5/30/07, Stefan Bodewig <bo...@apache.org> wrote:
> On Wed, 30 May 2007, <yi...@users.sourceforge.net53> wrote:
> > On 5/30/07, Stefan Bodewig <bo...@apache.org54> wrote:
> >> On Tue, 29 May 2007, <yi...@users.sourceforge.net55> wrote:
> >> > I am trying to add a single file to a jar.
> >>
> >> Where is the file?  Inside a ZIP/JAR/WAR archive or in a plain
> >> directory on your disk?  You use src for the former and dir in the
> >> directory case.
> >>
> >> > This works:
> >> > <zipfileset dir="${src}" prefix="WEB-INF" includes="web.xml" />
> >>
> >> So it is in a directory.
> >>
> >> > This gives an error about not being able to access the file:
> >> > <zipfileset src="${src}/web.xml" prefix="WEB-INF" />
> >>
> >> web.xml certainly is no valid ZIP archive, so this can't work.
> >>
> >> Why do you want to use src at all?
> >>
> >> Stefan
> >
> > Maybe I'm doing this all backwards...  I have a <jar> task and there
> > are a bunch of <zipfileset>'s inside that point to the directories
> > and files that get included in the jar.
>
> zipfileset is different from a plain fileset in two ways.  (1) You can
> specify prefix/fullpath attributes to create a different structure
> than is on your disk and (2) you can use the src attribute to read
> from a ZIP file instead of a directory tree.
>
> In your case you only need (1) so there is no reason to use src at
> all.  Just build your zipfilesets using dir and everything should be
> fine.
>
> Stefan

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


Re: zipfileset dir vs src

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 30 May 2007, <yi...@users.sourceforge.net> wrote:
> On 5/30/07, Stefan Bodewig <bo...@apache.org> wrote:
>> On Tue, 29 May 2007, <yi...@users.sourceforge.net> wrote:
>> > I am trying to add a single file to a jar.
>>
>> Where is the file?  Inside a ZIP/JAR/WAR archive or in a plain
>> directory on your disk?  You use src for the former and dir in the
>> directory case.
>>
>> > This works:
>> > <zipfileset dir="${src}" prefix="WEB-INF" includes="web.xml" />
>>
>> So it is in a directory.
>>
>> > This gives an error about not being able to access the file:
>> > <zipfileset src="${src}/web.xml" prefix="WEB-INF" />
>>
>> web.xml certainly is no valid ZIP archive, so this can't work.
>>
>> Why do you want to use src at all?
>>
>> Stefan
> 
> Maybe I'm doing this all backwards...  I have a <jar> task and there
> are a bunch of <zipfileset>'s inside that point to the directories
> and files that get included in the jar.

zipfileset is different from a plain fileset in two ways.  (1) You can
specify prefix/fullpath attributes to create a different structure
than is on your disk and (2) you can use the src attribute to read
from a ZIP file instead of a directory tree.

In your case you only need (1) so there is no reason to use src at
all.  Just build your zipfilesets using dir and everything should be
fine.

Stefan

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


Re: zipfileset dir vs src

Posted by yitzle <yi...@users.sourceforge.net>.
On 5/30/07, Stefan Bodewig <bo...@apache.org> wrote:
> On Tue, 29 May 2007, <yi...@users.sourceforge.net> wrote:
> > I am trying to add a single file to a jar.
>
> Where is the file?  Inside a ZIP/JAR/WAR archive or in a plain
> directory on your disk?  You use src for the former and dir in the
> directory case.
>
> > This works:
> > <zipfileset dir="${src}" prefix="WEB-INF" includes="web.xml" />
>
> So it is in a directory.
>
> > This gives an error about not being able to access the file:
> > <zipfileset src="${src}/web.xml" prefix="WEB-INF" />
>
> web.xml certainly is no valid ZIP archive, so this can't work.
>
> Why do you want to use src at all?
>
> Stefan

Maybe I'm doing this all backwards...
I have a <jar> task and there are a bunch of <zipfileset>'s inside
that point to the directories and files that get included in the jar.

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


Re: zipfileset dir vs src

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 29 May 2007, <yi...@users.sourceforge.net> wrote:
> I am trying to add a single file to a jar.

Where is the file?  Inside a ZIP/JAR/WAR archive or in a plain
directory on your disk?  You use src for the former and dir in the
directory case.

> This works:
> <zipfileset dir="${src}" prefix="WEB-INF" includes="web.xml" />

So it is in a directory.

> This gives an error about not being able to access the file:
> <zipfileset src="${src}/web.xml" prefix="WEB-INF" />

web.xml certainly is no valid ZIP archive, so this can't work.

Why do you want to use src at all?

Stefan

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