ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew van Renen" <avanre...@hotmail.com>
Subject Re: zipping a single file
Date Wed, 28 Aug 2002 15:38:25 GMT
Thanks for the response (I have found this newsgroup as a whole to be very 
responsive and community-minded).  It raises two questions for me:

1. I obviously don't fully understand the 'includes' attribute: the manual 
says "...list of patterns of files" - does that mean then that it acts only 
as a filter and so requires further definitions with <include/exclude> 
elements?

2. 'CVS version of Ant' - so not part of the 1.5 build then.  Is it going to 
be a part of the next release, or does this mean that there are all sorts 
bits and pieces that only (and forever) exist on SourceForge (so requiring a 
manual extraction and build to make use of them)?

	Andrew

Erik Hatcher  wrote:
>Yes, but only with the CVS version of Ant.  I added a 'file' attribute to 
>FileSet such that you can now say this:
>
>	<fileset file="/some/path/to/a/file.txt"/>
>
>And it will create the fileset with only that one file.  Internally it does 
>the same thing as the basename and includes, but its much more pleasant to 
>work with and you don't have to worry about property immutability biting 
>you!  :)
>
>	Erik
>
>
>Andrew van Renen wrote:
>>I want to add a single file to an archive.  Looking through the docs, I 
>>expected to be able to write:
>>
>>     <zip includes="${to}" destfile="${backup_zip}"
>>
>>but this returned the error: "basedir attribute must be set, or at least 
>>one fileset must be given!".
>>
>>So I ended up with:
>>
>>     <dirname property="to.path" file="${to}"/>
>>     <basename property="to.filename" file="${to}"/>
>>     <zip destfile="${backup_zip}">
>>         <fileset dir="${to.path}" includes="${to.filename}"/>
>>     </zip>
>>
>>That seems a little laborious - is there an easier way?
>>


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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


Mime
View raw message