It depends on the context.
When used as a classpath for the javac
task, the missing directories are simply ignored:
This task will drop all entries that point to non-existent
files/directories from the classpath it passes to the compiler.
But if you use a path containing a non-existent directory, say as the source for a copy
, you'll get an error.
For example, here directories 'one' and 'three' exist, but 'two' does not:
<path id="mypath">
<pathelement path="one" />
<pathelement path="two" />
<pathelement path="three" />
</path>
<copy todir="dest">
<path refid="mypath" />
</copy>
BUILD FAILED
/.../build.xml:14: Warning: Could not find resource file ".../two" to copy.
You could use a dirset
to filter out the missing items perhaps:
<pathconvert property="dirs.list" pathsep="," refid="mypath">
<map from="${basedir}/" to="" />
</pathconvert>
<dirset id="exists.dirs" dir="." includes="${dirs.list}" />
<copy todir="dest">
<dirset refid="exists.dirs" />
</copy>
[copy] Copied 2 empty directories to 2 empty directories under /.../dest