检查与蚂蚁参考 [英] Checking a reference with ant
问题描述
有没有办法在蚂蚁检查具体REFID参考某处定义?
例如,我需要检查如下,使用前应my.ref定义。
< pathconvert财产=my.propREFID =my.ref>
...
< / pathconvert>
我需要做的是,因为在我的项目有它不是我的控制下(实际上,我不准,有时审视自己的内容)的一些构建脚本。
这些脚本都应该定义此引用。不幸的是,我不能指望这个基准是指由于某种原因。
所以,我需要检查,并做优雅错误处理或某些具体的行动。
有没有办法做到这一点?
更新:
我找到了正确的方法做我自己。
它可以用做 isreference
的 Condition元素
任务。
例如:
<条件属性=my.ref.defined>
< isreference REFID =my.ref/>
< /条件>
<失败,除非=my.ref.defined消息=引用my.ref没有定义。/>
您可以设置基础上的的参考的值,然后测试该属性。例如:
<属性名=my.prop值=$ {的toString:my.ref}/>
Is there any way to check in ant that a reference with specific refid is defined somewhere?
For example, I need to check that my.ref is defined before using it as follows.
<pathconvert property="my.prop" refid="my.ref">
...
</pathconvert>
I need to do it since in my project there are some build scripts which not under my control (actually, I am not allowed to examine their content sometimes).
These scripts are supposed to define this reference. Unfortunately, I can't count that this reference is defined due to some reason.
So, I need to check it and perform graceful error handling or some specific actions.
Is there any way to do it?
Update:
I found the correct way to do it myself.
It can be done by using isreference
element of the condition
task.
For instance:
<condition property="my.ref.defined">
<isreference refid="my.ref"/>
</condition>
<fail unless="my.ref.defined" message="Reference my.ref not defined."/>
You can set a property based on the value of a reference, then test that property. For example:
<property name="my.prop" value="${toString:my.ref}" />
这篇关于检查与蚂蚁参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!