当出现问题时,我正在尝试处理具有长错误消息而不是短值的字符串。我的 ant 脚本包含以下代码:
<!-- build.svnversion is invalid if it's longer than 15 characters -->
<length property="build.svnversion.length" string="${build.svnversion}" />
<echo message="build.svnversion.length: ${build.svnversion.length}"/>
<condition property="build.svnversion" value="N/A" else="${build.svnversion}">
<length string="${build.svnversion}" when="gt" length="15" />
</condition>
<echo message="build.svnversion: ${build.svnversion}" />
这会产生以下输出:
[echo] build.svnversion.length: 148
[echo] build.svnversion: svn: The path '.' appears to be part of a Subversion 1.7 or greater
[echo] working copy. Please upgrade your Subversion client to use this
[echo] working copy.
为什么 build.svnversion 不设置为 N/A,因为它的长度明显大于 15?