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
TehNrdTehNrd 

Need help deploying with ANT

Due to some other issues (http://community.salesforce.com/sforce/board/message?board.id=apex&thread.id=8720 , http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=8138 ) I am unable to deploy code with the Eclipse Force.com toolkit.

I have looked over the ant documentation but to be honest I need it dumbed down a little....errr maybe a lot.

- I have installed ant here: c:\ant
- I have placed the ant-salesforce.jar file here: c:\ant\lib

Now I am supposed to set the environment variables (such as ANT_HOME, JAVA_HOME, and PATH) but I have no idea where I do this.

I think this is my correct Java directory: C:\Program Files\Java\jre1.6.0_07.

Once this is complete I'm still not sure how to proceed.

Thanks,
Jason


Message Edited by TehNrd on 10-14-2008 05:02 PM
JonPJonP
There are several ways to set these environment variables on Windows, but this is the simplest:

1. From the My Computer icon on your desktop, right-click and select Properties
2. In the System Properties dialog, select the Advanced tab and click Environment Variables
3. In the Environment Variables dialog, "User variables" only apply to the current user, and "System variables" are global for all users.  You must decide which is appropriate.  (User variables override or are concatenated with system variables.)
4. Use the New button to add variables for ANT_HOME and JAVA_HOME.
5. You probably have a PATH variable defined already.  Highlight this row and click Edit to add more folders to your path.

To test, run CMD.EXE and type "set".  This displays all the current environment variables and their values.
TehNrdTehNrd
Thanks for telling me how to set up the environmental variables. I am now able to start the deployment process by typing "ant deployCode" in the cmd prompt but I am now receiving this error:

"Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.6.0_07\lib\tools.jar




Message Edited by TehNrd on 10-15-2008 10:02 AM
JonPJonP
That is a Java configuration/installation issue.  I would check your JAVA_HOME value, but a Google search or a visit to java.sun.com will provide an answer more quickly than trying to troubleshoot it here.
TehNrdTehNrd
My user name and password were incorrect. I left the < and > around them in the build.properties file. Even with the tools.jar error it appears to be working but now I am hitting code coverage errors which is odd as it passes fine in the UI when I hit Run All Tests.

In the build.xml file there is this:

Code:
    <target name="deployCode">
      <!-- Upload the contents of the "codepkg" directory, running the tests for just 1 class -->
      <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="codepkg">
        <runTest>SampleDeployClass</runTest>
      </sf:deploy>
    </target>

Where it points to a folder "codepkg" does this folder need to include all of the components that are currently in the target instance or only the new class, triggers, pages that you are trying to deploy.

Thanks.



Message Edited by TehNrd on 10-15-2008 10:11 AM
JonPJonP
The codepkg folder should only contain the file(s) you want to deploy.  If you want to run all tests in your organization as the final step of the deployment before committing changes, add the attribute runAllTest="true" to your <sf:deploy> tag.  (If it's actuallly runAllTests, let me know so we can fix the docs.)

Also, the build.xml file and folders in the Force.com Migration Tool are just samples.  You can probably get by with little to no changes, but the intention is for you to construct your own build.xml file so you don't have to rigidly use the same targets, folder names, etc., that we provide in the zip file. (Of course, you're welcome to do so if they meet your needs as-is.)


TehNrdTehNrd
So now I am encountering a timeout issue. Here are all of my files:

build.properties
Code:
# build.properties
#

# Specify the login credentials for the desired Salesforce organization
sf.username = username@domain.com.test
sf.password = ********
sf.maxPoll = 500
sf.pollWaitMillis = 5000

# Use 'https://www.salesforce.com' for production or developer edition (the default if not specified). # Use 'https://test.salesforce.com for sandbox. sf.serverurl = https://test.salesforce.com # If your network requires an HTTP proxy, see http://ant.apache.org/manual/proxy.html for configuration. #

build.xml
Code:
<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">

    <property file="build.properties"/>
    <property environment="env"/>
 
 <target name="deployTest">
      <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" runAllTests="true" deployRoot="deployTest"/>
 </target>
</project>

package.xml
Code:
<—xml version="1.0" encoding="UTF-8"–>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <version>13.0</version>
</Package>

Here is my file structure:

deploy (folder)
|--- deployTest (folder)
      |--- classes (folder)
      |      |--- accountSiteTEST.cls
      |      |--- accountSiteTEST.cls-meta.xml
      |--- triggers (folder)
      |      |--- accountSite.trigger
      |      |--- accountSite.trigger-meta.xml
      |--- package.xml
|--- build.properties
|--- build.xml


Error says: Request timed out. If this is a large set of metadata components, check that the time allowed by the maxPoll and pollWaitMilliis attributes is sufficient.

I probably messed up the build.properties file but I'm not sure where to set these attributes.




Message Edited by TehNrd on 10-16-2008 11:53 AM
JonPJonP
You need to actually pass the values of maxPoll and maxWaitMillis as parameters to the <sf:deploy> task.  Right now it is still using the default values, which are clearly too small for your needs.
TehNrdTehNrd
Success!!! We were able to push code changes to production.

SFDC-AcumenSFDC-Acumen
Thanks guys, this helped me overcome the frustration of constant timeouts deplying with the ant tool!
PadsfdcPadsfdc

Hi,

 

        I am new for  Ant force.com migration tool.I followed Force.com Migration tool pdf .But i have so many doubts on that.I understand upto build.property file connection . can u send me detailed information about migration.

 

Thanks

Padsfdc

BSKumarBSKumar

Hi,

I am trying to setup CI using Jenkins(cloudbees.com), When i try to deploy using migration tollkit on command prompt build successful, But if i configure in jenkins then i am getting the time out error

 

[sf:deploy] Request timed out. If this is a large set of metadata components, check that the time allowed by the maxPoll and pollWaitMillis attributes is sufficient.
 
build.xml

<project name="salesforce" basedir="." xmlns:sf="antlib:com.salesforce">

<property file="build.properties"/>
<property environment="env"/>

<target name="deployCode">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" logType="Detail" checkOnly="true" runAllTests="true" deployRoot="src"/>
</target>

<target name="undeployCode">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="undeploy"/>
</target>

</project>

 

build.properties

sf.username = myusername
sf.password = mypassword with Security token

sf.serverurl = https://login.salesforce.com
sf.pollWaitMillis = 100000000000000000000
sf.maxPoll = 10000000000000

 

Can any one help me to fix this issue.?