2013-06-20 3 views
0

이 아닌 Ant 빌드를 작성하려고하는데,은 Ant의 lib 디렉토리 또는 /home/myuser/.ant/lib에있는 Ant 플러그인을 추가하거나 Eclipse 인스턴스의 개미 등을 추가해야합니다. 즉, 결국 필자는 시스템의 Ant 설치에 액세스 할 수없는 호스팅 된 젠킨스 서버에서 프로젝트를 구축 할 것이기 때문입니다.셀프 부트 스트랩과 관련된 오류 Ant 빌드

아이비를 사용하여 빌드 타임에 내 앤트 플러그인을 풀기 때문에 이것을 "자체 부트 스트랩"빌드라고 부르며, 적절한 구성으로 Ant에서 동적으로 작업을 수행 할 수 있기를 바랍니다.

내 빌드 광주 과학 기술원 (예를 들어 ant-contrib 플러그인을 사용하여 :

<?xml version="1.0" encoding="utf-8" ?> 
<project name="myapp" default="audit" basedir="." 
     xmlns:ivy="antlib:org.apache.ivy.ant" 
     xmlns:antcontrib="antlib:net.sf.antcontrib"> 

    <!-- Build path. --> 
    <path id="build.path"> 
     <fileset dir="${lib.buildtime.dir}" includes="**/*.jar"/> 
    </path> 

    <target name="bootstrap"> 
     <taskdef resource="org/apache/ivy/ant/antlib.xml" 
      uri="antlib:org.apache.ivy.ant" classpathref="build.path"/> 
    </target> 

    <target name="resolve" depends="bootstrap"> 
     <ivy:settings url="${ivy.settings.home}"/> 

     <ivy:cleancache/> 

     <ivy:resolve file="${ivy.xml}"/> 

     <ivy:retrieve pattern="${gen.lib.main.dir}/[artifact]-[revision].[ext]" conf="main"/> 
     <ivy:retrieve pattern="${gen.lib.test.dir}/[artifact]-[revision].[ext]" conf="test"/> 
     <ivy:retrieve pattern="${gen.lib.buildtime.dir}/[artifact]-[revision].[ext]" conf="buildtime"/> 

     <ivy:report todir="${gen.staging.dir}" /> 

     <ivy:cachepath pathid="build.path" conf="buildtime"/> 
    </target> 

    <target name="taskdefs" depends="resolve"> 
     <taskdef resource="/net/sf/antcontrib/antlib.xml" 
      uri="antlib:net.sf.antcontrib" classpathref="build.path"/> 

     <property name="fizz" value="buzz" /> 

     <antcontrib:if> 
      <antcontrib:equals arg1="${fizz}" arg2="buzz" /> 
      <antcontrib:then> 
       <echo message="Fizz is buzz!" /> 
      </antcontrib:then> 
      <antcontrib:else> 
       <echo message="Fizz is not buzz!" /> 
      </antcontrib:else> 
     </antcontrib:if> 
    </target> 
</project> 

을 나는 taskdefs 목표를 실행하면, 대신 에코 보는 "피즈는 버즈입니다!"라는 메시지가 내 개미 출력,

BUILD FAILED 
/home/myuser/eclipse/workspace/myapp/build.xml:169: Problem: failed to create task or type antlib:net.sf.antcontrib: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. 
No types or tasks have been defined in this namespace yet 

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of: 
    -/home/myuser/eclipse/plugins/org.apache.ant_1.8.3.v201301120609/lib 
    -/home/myuser/.ant/lib 
    -a directory added on the command line with the -lib argument 

이 불가능 (위의 3 추천 일의 1을 할 필요가 없도록) 내가 뭘하려고하는 경우 그래서, 왜 그렇지 않을 경우, 내 설정에 어떤 문제가 있는지 여기에 : 나는 다음과 같은 오류가 발생합니다? 미리 감사드립니다.

답변

1

나는 일반적으로 하나의 "boostrap"타겟을 생성하고 이것을 사용하여 "$ HOME/.ant/lib"디렉토리에 아이비를 설치합니다. 참조 : 다음

은보다 완벽한 예입니다 당신이 뭘 하려는지 않습니다 :

결론적으로, 그것은이다 부끄러운 아이비는 기본적으로 ANT와 함께 패키지되지 않습니다. 당신이 발견 한 경우 호스팅 서비스가 홈 디렉토리에 파일을 복사하지 못하도록, 아마도 가장 간단한 것은 소스와 함께 담쟁이 항아리의 사본을 제공 (그리고 taskdef를 사용하여 사용 가능)입니다

업데이트

개미-있는 contrib에 대해 다음 taskdef를 사용

<taskdef uri="antlib:net.sf.antcontrib" classpathref="build.path"/> 

homepage 요구 업데이트를. 최근의 어떤 단계에서 도서관은 antlib으로 재 포장되었습니다.

+0

감사합니다. @Mark O'Connor (+1) - 두 링크를 매우 신중하게 읽고 두 번째 링크가 권장하는 모든 작업을 수행하고 있으며 여전히 동일한 빌드 오류가 발생합니다. 오류가 발생하는 모든 빌드 대상을 포함하도록 원래 게시물을 업데이트했습니다. ** 어디 갈 수있어 내가 awrye 갈거야 ?? ** 다시 고마워! –

+0

@TicketMonster 발견! 내 대답을 업데이트했습니다. –