简体   繁体   中英

How to avoid CopyTask and MoveTask phing build exception on not existing file

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?

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>

我添加了票证(请参阅http://phing.info/trac/ticket/582 ),以将haltonerror属性添加到复制/移动任务。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM