2016-09-28 8 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

다음 대답은 누락 된 제 3 자 의존성을 설치하는 방법을 보여줍니다 : http://stackoverflow.com/questions/34351322/there-isnt-antlib-xml-in-my- 예를 들어

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

답변

1

왜냐하면 ifant-contrib 라이브러리의 맞춤 작업이기 때문입니다.

클래스 경로에 개미도 개 라이브러리가 있는지 확인하십시오. 바이너리는 here에서 다운로드 할 수 있습니다. ant-contrib jar 파일을 위치로 추출하십시오. 그리고 아래에 같은 것을 지정하십시오 taskdef.

그런 다음 의 build.xml의 시작 부분에 taskdef를 추가합니다. 자세한 내용은 documentation을 참조하십시오.

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

Omg 덕분에 완벽하게 작동했습니다. – Lost