I'm trying to do bundle up some files, if they exist. So I create a path with include="**/CDM/*.sql" and iterate with foreach on that path.
This works fine if there is at least one file matching that pattern. But if there is no such file I get:
You must have a list or path to iterate through
and the build fails.
Is there a standard workaround for this? Is there a way to tell when the path is empty?
This behavior seems non-intuitive. It seems to me like foreach should just do nothing if there is nothing in its list or path. It should just be an empty iterator.
Why not surround the foreach with the 'if' task?
What do you mean by "bundle up"? Can you not use the 'zip' task?
foreach now works correctly if the path yields no entries.