我在os x服务器(Lion)上安装了一个jenkins,我想让它调用一个ant脚本来编译一个sigle示例项目。
istallation有一个专用用户,“jenkins”,如果我从ssh实例中记录他,我可以成功运行编译任务(使用常春藤的任务):
jenkins>ant compile
当web界面调用ant时出现问题,收到此错误:
Problem: failed to create task or type antlib:org.apache.ivy.ant:resolve
原因:ant无法从库中正确加载常春藤的解析任务。我真的无法理解修复。我确信jenkins以“jenkins”用户的身份运行命令。
修改:更多信息
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
答案 0 :(得分:3)
看起来詹金斯工作使用的ANT安装无法拿起常春藤罐。
将以下目标添加到ANT构建中并调用一次以将常春藤罐安装到ANT将识别的位置,即$ HOME / .ant / 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&g=org.apache.ivy&a=ivy&v=LATEST&e=jar"
dest="${user.home}/.ant/lib/ivy.jar"/>
</target>
注意:
如果常春藤罐位于以下目录中:
您可以使用 lib 参数调用ANT来指定ANT插件的指定备用位置。
ant -lib /usr/local/bin/ivy clean build
答案 1 :(得分:0)
运行Ant任务时,在类路径中确保ivy.jar存在。在日食 - &gt;运行As-&gt; Ant Build - &gt;编辑配置 - &gt; Classpath选项卡。即使Eclipse在ANT Home中有ivy.jar,但由于某些原因它没有被调用。