2016-09-28 6 views
1

これは私がやろうとしているものです:このターゲットを条件付きにしようとすると

<target name="example"> 
    <if> 
     <equals arg1="${var}" arg2="true" /> 
     <then> 
     <exec executable="/bin/bash"> 
      <arg value="script.sh" /> 
     </exec> 
     </then> 
    </if> 
</target> 

そして、私はアリの例でターゲットを実行するとき、私はこのエラーを取得:

Problem: failed to create task or type if 
Cause: The name is undefined. 
Action: Check the spelling. 
Action: Check that any custom tasks/types have been declared. 
Action: Check that any <presetdef>/<macrodef> declarations have taken place. 

私は本当に必要ここで助けてください。私は本当にそれを感謝します

+0

以下の答えが不足しているサードパーティの依存関係をインストールする方法を示します:http://stackoverflow.com/questions/34351322/there-isnt-antlib-xml-in-my-などについては

ant-contrib-0-3/34361910#34361910 –

答えて

1

これは、ifant-contribライブラリからのカスタムタスクです。

クラスパスにant-contribライブラリがあることを確認してください。バイナリはhereからダウンロードできます。 ant-contrib jarファイルを特定の場所に抽出します。下に同じものを指定してくださいtaskdef

taskdefを、build.xmlの先頭に追加します。詳細はdocumentationを参照してください。

<taskdef resource="net/sf/antcontrib/antcontrib.properties"> 
    <classpath> 
     <pathelement location="/absolute/path/to/ant-contrib-1.0b3.jar" /> 
    </classpath> 
</taskdef> 
+0

Omgありがとうございました。 – Lost

関連する問題