1. 基本语法
1-1. target
1-1-1. if
<target name="" if="prop">
仅当 if 指定的属性被设置时才执行
1-1-2. unless
<target name="" unless="prop">
仅当 unless 指定的属性没有被设置时才执行
2. 判断 JVM 版本
<project basedir="." default="test">
<target name="get-jvm">
<condition property="jvm.ok">
<not>
<equals arg1="${ant.java.version}" arg2="1.1"/>
</not>
</condition>
</target>
<target name="check-jvm" depends="get-jvm" unless="jvm.ok">
<fail message="Wrong JVM - ${ant.java.version}"/>
</target>
<target name="test" depends="check-jvm">
<echo message="JVM OK - ${ant.java.version}"/>
</target>
</project>
0 件のコメント:
コメントを投稿