Ant 未加载 Salesforce 任务定义? [英] Ant not loading salesforce task definitions?
问题描述
问题
我正在尝试在 linux 机器上使用 Force.com 迁移工具(一个自定义 ant 库),但终生无法弄清楚如何让 ant 查看该库.我做错了什么?
I'm trying to use the Force.com Migration Tool (a custom ant library) on a linux box and can't for the life of me figure out how to get ant to see that library. What am I doing wrong?
错误信息
BUILD FAILED
/home/ec2-user/ant/ucp/build.xml:48: Problem: failed to create
task or type antlib:com.salesforce:retrieve
Cause: The name is undefined.
背景
我使用 yum install ant
安装了 ant,然后我将 Force.com 迁移工具 (ant-salesforce.jar) 放入 /usr/share/ant/lib
.当我运行 ant -diagnostics
时,我能够看到这个库,但没有看到该库的任何任务(应该看到部署、检索等).我上传了一个 gist 和 ant -diagnostics
的完整输出.
I installed ant using yum install ant
and then I dropped the Force.com Migration Tool (ant-salesforce.jar) into /usr/share/ant/lib
. I'm able to see this library when I run ant -diagnostics
, but none of the tasks for that library (should be seeing deploy, retrieve, etc.). I've uploaded a gist with the full output from ant -diagnostics
.
-------------------------------------------
ANT_HOME/lib jar listing
-------------------------------------------
ant.home: /usr/share/ant
ant-bootstrap.jar (19837 bytes)
ant-salesforce.jar (3293054 bytes)
ant.jar (1942059 bytes)
ant-launcher.jar (18418 bytes)
经过大量谷歌搜索和手动阅读后,我尝试了以下操作但无济于事(注意:上述诊断没有以下任何更改).我知道我错过了一些明显的东西:(
After lots of googling and manual reading I tried the following to no avail (NB: the above diagnostics is without any of the below changes). I know I'm missing something obvious :(
- 设置 $ANT_HOME
export ANT_HOME=/usr/share/ant
- 摆弄权限
chmod +x/usr/share/ant/lib/salesforce-jar
- 摆弄组
chown root:root/usr/share/ant/lib/salesforce-jar
- 使用 -lib 在类中传递
ant -lib/usr/share/ant/lib/salesforce-jar 检索 ...
- 使用 -lib 传入 lib 文件夹
ant -lib/usr/share/ant/lib 检索 ...
- 将 $ANT_HOME 添加到 $PATH
export PATH=$PATH:$ANT_HOME/bin
推荐答案
如何将 ant-salesforce.jar
放在 /home/ec2-user/ant/ucp
下然后将 taskdef
元素更改为如下所示:
How about keeping ant-salesforce.jar
under /home/ec2-user/ant/ucp
and then change the taskdef
element to look like this:
<taskdef resource="com/salesforce/antlib.xml" classpath="ant-salesforce.jar" />
再次运行您的构建,看看情况是否更好.将 JAR 与 build.xml
放在同一文件夹中将帮助您消除权限问题.
Run your build again and see if things look better. Having the JAR in the same folder as build.xml
will help you eliminate issues with permissions.
这篇关于Ant 未加载 Salesforce 任务定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!