How to avoid CopyTask and MoveTask phing build exception on not existing file
Question
I'm creating build file for phing. The problem is that it must move a file which may not exist. If it doesn't I get BuildException
"Could not find file ... to copy".
In the Ant there was a property failonerror
which ignored the errors of move and copy tasks, but there is no similar property for phing move and copy tasks.
Move phing code:
<move file="no_such_file.txt" tofile="other_path.txt" overwrite="true" />
Is there any built in functionality to catch the errors using phing build? Or maybe it's possible to check on file existence before moving?
Solution
I have avoided the problem using such move task:
<move todir="${dir}" overwrite="true">
<mapper type="glob" from="no_such_file.txt" to="other_path.txt"/>
<fileset dir="${dir}" />
</move>
OTHER TIPS
I've added a ticket (see http://phing.info/trac/ticket/582) to add a haltonerror attribute to the copy/move tasks.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow