Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fileset doesn't support the "erroronmissingdir" attribute

Tags:

ant

I am using ant 1.7, getting following error:

build.xml:55: fileset doesn't support the "erroronmissingdir" attribute

what is the alternative attribute for erroronmissingdir( it is in 1.8) in 1.7

like image 912
TechFind Avatar asked Jun 27 '11 10:06

TechFind


1 Answers

The fileset erroronmissingdir attribute is available since Ant 1.7.1. You must be using an earlier release of 1.7.

The attribute is used to tell the build to silently ignore filesets for which the base dir does not exist at execution time:

<copy todir="tmp">
  <fileset dir="foo" erroronmissingdir="false">
    <include name="**/*"/>
  </fileset>
</copy>

If you do not specify erroronmissingdir="false" (or cannot, because your version of Ant does not support it), then the default result is build failure if the dir foo does not exist.

If you need your build to succeed whether or not the dir exists, and you cannot use the erroronmissingdir attribute, you have some options.

For example, you could specify the base dir of the fileset to be a known-to-exist parent of your target dir, something like this:

  <copy todir="tmp">
    <fileset dir=".">
      <include name="foo/**/*"/>
    </fileset>
  </copy>

(Note in this case, the copy will now create dir foo in the todir of the copy. You could strip that using a glob mapper.)

Another alternative would be to execute your conditionally available fileset operations in targets, guarded by a condition, e.g.

<available property="foo.available" file="foo"/>

<target name="test" if="foo.available">
  <copy todir="tmp">
    <fileset dir="foo">
      <include name="**/*"/>
    </fileset>
  </copy>
</target>

Output with ant -v will show:

[available] Unable to find foo to set property foo.available
test: Skipped because property 'foo.available' not set.
BUILD SUCCESSFUL Total time: 0 seconds
like image 80
sudocode Avatar answered Nov 02 '22 07:11

sudocode