【发布时间】:2011-08-03 13:55:52
【问题描述】:
我有一个与 ant 一起使用的 build.xml,我正在尝试在目标中放置一个条件:
首先我在这里设置了可以正常工作的属性:
<condition property="isWindows">
<os family="windows"/>
</condition>
然后我尝试在目标中使用它:
<target name="-post-jar">
<condition property="isWindows" value="true">
<!-- set this property, only if isWindows set -->
<property name="launch4j.dir" location="launch4j" />
</condition>
<!-- Continue doing things, regardless of property -->
<move file="${dist.jar.dir}" tofile="myFile"/>
<!-- etc -->
</target>
我收到一个错误:“条件不支持嵌套的“属性”元素。” 问题是:如何正确地将条件放入目标中,为什么错误指的是“嵌套”属性?
【问题讨论】:
-
这看起来与 ant 文档中的语法一模一样。你确定你没有在条件任务中创建一个
元素(你已经写了“在这里做事”)?。 -
啊...我正在那里创建另一个属性(下一行是
这是不行吗?