2012-07-09 63 views
3

我有一個OS X服務器(獅子)jenkins安裝,我希望它調用一個ant腳本來編譯一個sigle示例項目。jenkins螞蟻調用和常春藤任務

的istallation有一個專門的用戶,「詹金斯」,如果我從ssh實例登錄他,我可以成功運行與編譯任務(這是使用常春藤的任務):

jenkins>ant compile 

問題開始時螞蟻是通過Web界面調用,收到此錯誤:

Problem: failed to create task or type antlib:org.apache.ivy.ant:resolve 

原因:螞蟻不會從庫中加載正確的常春藤的決心任務。我真的不明白這個問題。我相信詹金斯以「詹金斯」用戶的身份運行命令。

編輯:更多信息

BUILD FAILED 
/Users/Shared/Jenkins/Home/jobs/example-build/workspace/build.xml:19: Problem: failed to create task or type antlib:org.apache.ivy.ant:resolve 
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: 

    -/usr/share/ant/lib 
    -/Users/Shared/Jenkins/Home/.ant/lib 
    -a directory added on the command line with the -lib argument 

Total time: 0 seconds 
Build step 'Invoke Ant' marked build as failure 
Finished: FAILURE 
+2

請發佈完整的堆棧跟蹤,看起來像是常春藤庫不在螞蟻類路徑 – oers 2012-07-09 10:33:52

+0

編輯該問題。 – 2012-07-09 10:53:02

+0

你從哪裏安裝常春藤罐子? – Matteo 2012-07-09 11:21:14

回答

3

看起來像使用的詹金斯作業不能拿起罐子常春藤ANT安裝。

選項1

添加以下目標Ant構建並調用它一次常春藤罐子裝成ANT將認識的位置,即$ HOME /趙軍陽張志利/ lib目錄

<target name="bootstrap" description="Install ivy"> 
    <mkdir dir="${user.home}/.ant/lib"/> 
    <get src="https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&amp;g=org.apache.ivy&amp;a=ivy&amp;v=LATEST&amp;e=jar" 
     dest="${user.home}/.ant/lib/ivy.jar"/> 
</target> 

備註:

  • 此目標使用Sonatype的Nexus存儲庫提供的REST API來下載最新版本的ivy。

選項2

如果常春藤罐子位於以下目錄:

  • 在/ usr/local/bin目錄/常春藤

您可以調用Ant和lib參數指定給ANT插件的指定替代位置。

ant -lib /usr/local/bin/ivy clean build 
0

當您運行Ant任務時,請在類路徑中確保ivy.jar在那裏。在eclipse - > Run As-> Ant Build - >編輯配置 - > Classpath選項卡中。儘管Eclipse會在ANT Home中使用ivy.jar,但由於某種原因,它並未被調用。