2012-07-09 64 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,但由于某种原因,它并未被调用。