function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
collinbcollinb 

Migration Tool Issues

Hi, I'm new to the Migration Tool and am finding it difficult to get working.  I have been through the guides and can't find any help on the problem I'm having.

 

This is the error I am receiving:

 

 Macintosh-3:DevGuide collinbrown$ ant
Buildfile: build.xml

InitUsers:

BUILD FAILED
/Users/collinbrown/Documents/BACR/Salesforce/DevGuide/build.xml:170: Problem: failed to create task or type antlib:com.salesforce:deploy
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.

This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
        -/usr/share/ant/lib
        -/Users/collinbrown/.ant/lib
        -a directory added on the command line with the -lib argument


Total time: 0 seconds
 

Any help will be greatly appreciated!

Collin

 

Best Answer chosen by Admin (Salesforce Developers) 
collinbcollinb

Ok, I figured it out!

 

I don't know if its the right way to do it, but it works.

 

In a terminal(MAC), I declared the path for the lib when I ran the target.

 

It looked like this:

 Macintosh-3:DevGuide collinbrown$ ant -lib /Applications/eclipse/plugins/org.apache.ant_1.7.0.v200706080842/lib Chapter3

 

Thanks for all your help!

All Answers

akhilesh_sfdcakhilesh_sfdc
It seems like you haven't included the library (ant-salesforce.jar) which comes along the tool. As the error says, one way to do that would be to copy the library (ant-salesforce.jar) to $HOME/.ant/lib folder and also create a config file ($HOME/.ant/ant.conf) which contains the classpath to this file as "CLASSPATH=$HOME/.ant/lib/ant-salesforce.jar". Do not include the double quotes. Also, replace all the instances of $HOME above with your user home, which for your case is "/Users/collinbrown".
collinbcollinb

I'm sorry, I forgot to mention that I'm working with Eclipse.  Ant was installed with that software, and I copied the ant-salesforce.jar to this path: /Applications/eclipse/plugins/org.apache.ant_1.7.0.v200706080842/lib

 

does this change anything?

 

Thanks

collinbcollinb

Ok, I figured it out!

 

I don't know if its the right way to do it, but it works.

 

In a terminal(MAC), I declared the path for the lib when I ran the target.

 

It looked like this:

 Macintosh-3:DevGuide collinbrown$ ant -lib /Applications/eclipse/plugins/org.apache.ant_1.7.0.v200706080842/lib Chapter3

 

Thanks for all your help!

This was selected as the best answer
akhilesh_sfdcakhilesh_sfdc
Yes, this is also a totally valid way of specifying the library for ant to use. I believe the approach I mentioned earlier should also solve the problem while using it inside eclipse, though I haven't tried it.
velocityvelocity

Awesome post. This post helped me in setting up ANT, as I am too new in Software field!! Thankyou akhilesh_sfdc!!

Clifford FajardoClifford Fajardo
@collinb 's response solved the issue for me (using Mac). I moved the ant-salesforce.jar file to /Users/{your_username_here}/.ant/lib. BUT, before I did this I noticed that I didn't have the .ant nor the sub directory, so I created those new folders:
  •  mkdir -p /Users/{your_username_here}/.ant/lib/  
  • then copied the salesforce jar file to the lib folder I just created above. cp ~Downloads/ant-salesforce.jar /desitination/folder


I had installed Ant via homebrew, so that probably had to do with why all of the instructions from Salesforce's website references paths I didn't have on my system.
harsh rohillaharsh rohilla
Copying ant-salesforce.jar in ant lib solved the issue for me (windows). Thankyou collinb.