Scott,

you are correct - A FileSet will break if the directory does not exist.
If you feel strongly about this bug (as I do), then please cast a vote for
it - see link

"FileSet and DirSet break if the directory does not exist"
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11270


To get around your problem, you can create the directory (as you have
surmised).
Or you can skip targets containing the fileset by using a combination of the
Available task and depends - very clunky.
Or specify a fileset whose directory is known to exist and use the
<include><exclude> to filter the files - may inclde relative paths that are
not suitable.

I sugest option 1, and help get it fixed for Ant 1.6 :-)


William

> -----Original Message-----
> From: Scott Ellsworth [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 2 August 2002 8:31
> To: Ant List
> Subject: Can a jar fileset/zipfileset refer to a nonexistent
> directory?
>
>
> Our developers want to include the contents of the "images" directory
> into produced zip files if it exists.
>
> The code is simple enough:
>
>    <property name="compile.images"
> value="${project.work.dir}/images"/>
>
>    <target name="jar" >
>      <mkdir dir="${jar.dist}"/>
>      <jar
>        jarfile="${jar.dist}/${jar.baseName}.jar"
>        compress="${jar.compress}">
>        <zipgroupfileset dir="${compile.product.dir}"
> includes="${jar.extra.product.zip}"/>
>        <zipgroupfileset dir="${compile.library.dir}"
> includes="${jar.extra.library.zip}"/>
>        <zipfileset dir="${compile.images}" prefix="images"/>
>        <fileset dir="${compile.classes}"/>
>      </jar>
>    </target>
>
> The problem comes if the "images" directory does not exist.
> The build
> will then fail with
>
> file:/Users/work/Documents/coding/isis/source/build/standard-
> build.xml:202:
> /Users/work/Documents/coding/isis/source/metagraph/persistence
> /persistable/
> images not found.
>
> I could create it in every one of our hundred or so projects
> with a one
> line mkdir, but the developers have already said that they do
> not want
> that.  They feel that the directory should only exist in the
> file system
> if there are actually images to process, and thus making a
> zillion such
> directories just in case they may exist some day.
>
> So, any suggestions?
>
> Scott
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to