Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make nant complain when a file is missing from a fileset

Tags:

nant

fileset

I have a fileset element in a build file that is defined as:

<fileset id="fileset" basedir=".">
    <include name="test.txt"/>
    <include name="missing.txt"/>
</fileset>

When this runs (as part of a copy task), it does not complain if any of the files are missing. Whilst I can use failonempty="true" in the fileset element, this only fails if both files are missing.

I can achieve this by making multiple filesets with failonempty="true" set, each one containing a single file, but this feels clunky. This is also a maintenance problem if there are lots of required files.

Is there any way of making nant complain if any of the files in the fileset are missing? If this is not possible, is there another way of achieving the same effect?

like image 834
adrianbanks Avatar asked Dec 29 '25 15:12

adrianbanks


1 Answers

Add attribute asis="true":

<fileset id="fileset" basedir=".">
  <include name="test.txt" asis="true" />
  <include name="missing.txt" asis="true" />
</fileset>

NAnt will complain then in case the file is missing.

like image 73
The Chairman Avatar answered Jan 01 '26 18:01

The Chairman