ant を使用していますが、if/then/else タスク (ant-contrib-1.0b3.jar) に問題があります。以下のbuild.xmlで簡素化できるものを実行しています。
「ant -Dgiv=Luke」からメッセージを取得することを期待しています
input name: Luke
should be overwritten with John except for Mark: John
しかし、プロパティ "giv" は if/then/else. 内で上書きされないようです。
input name: Luke
should be overwritten with John except for Mark: Luke
equals タスクを使用しているという事実に依存してい${giv}
ますか? それ以外の場合、私のコードの何が問題になっていますか?
build.xml コード:
<project name="Friend" default="ifthen" basedir=".">
<property name="runningLocation" location="" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${runningLocation}/antlib/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<target name="ifthen">
<echo message="input name: ${giv}" />
<if>
<equals arg1="${giv}" arg2="Mark" />
<then>
</then>
<else>
<property name="giv" value="John" />
</else>
</if>
<echo message="should be overwritten with John except for Mark: ${giv}" />
</target>
</project>