Ant not loading Salesforce task definitions?

Question

I’m trying to use the Force.com migration tool (ant user library) in my Linux box and I’ve been unable to figure out for life how to get ant to see this library. What am I doing wrong?

Error message

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. 

Background

I installed ant using yum install ant , and then I dropped the migration tool Force.com (ant -salesforce.jar) in /usr/share/ant/lib . I can see this library when I run ant -diagnostics , but none of the tasks for this library (should not be considered as deployment, extraction, etc.). I downloaded gist with full exit 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 many searches and manual reading, I tried the following to no avail (NB: the above diagnostics without any changes). I know that I am missing something obvious :(

  • Setting $ ANT_HOME export ANT_HOME=/usr/share/ant
  • Enable with permissions chmod +x /usr/share/ant/lib/salesforce-jar
  • Merging with chown root:root /usr/share/ant/lib/salesforce-jar groups chown root:root /usr/share/ant/lib/salesforce-jar
  • Passing in a class using -lib ant -lib /usr/share/ant/lib/salesforce-jar retrieve ...
  • Going to the lib folder using -lib ant -lib /usr/share/ant/lib retrieve ...
  • Adding $ ANT_HOME to $ PATH export PATH=$PATH:$ANT_HOME/bin
+4
source share
2 answers

How to save the ant-salesforce.jar under /home/ec2-user/ant/ucp , and then change the item taskdef , to look like this:

 <taskdef resource="com/salesforce/antlib.xml" classpath="ant-salesforce.jar" /> 

Run your build again and see if everything looks better. Having a JAR in the same folder as build.xml will help you troubleshoot permission issues.

+6
source

Based on @smooth_reggae's answer, I managed to get everything working by storing ant -salesforce.jar in the default ant lib directory. It seems like this should already be happening, but oh-well.

 <taskdef resource="com/salesforce/antlib.xml" classPath="${ant.library.dir}/ant-salesforce.jar" uri="antlib:com.salesforce"/> 
+4
source

Source: https://habr.com/ru/post/1479181/


All Articles