2

I am trying to deploy just classes folder as I am not able to deploy entire src folder because of size issue as mentioned in this post

Here is the task I added in my build.xml:

<target name="deployClasses">
  <sf:deploy username="${SFDC.username}" password="${SFDC.password}" 
             sessionId="${SFDC.sessionId}" serverurl="${SFDC.serverurl}" 
             maxPoll="600" deployRoot="../src/classes" rollbackOnError="true" 
             allowMissingFiles="true" pollWaitMillis="30000"/>
</target>

and here is the log when I run ant deployClasses from command prompt:

john@john:~/mm_workspace/my_SFDC_Project/ant_deploy$ ant deployClasses 
Buildfile: /home/john/mm_workspace/my_SFDC_Project/ant_deploy/build.xml

    deployClasses:
    [sf:deploy] Request for a deploy submitted successfully.
    [sf:deploy] Request ID for the current deploy task: 0Af29000001K8MECA0
    [sf:deploy] Waiting for server to finish processing the request...
    [sf:deploy] Request Status: Pending
    [sf:deploy] Request Status: Succeeded
    [sf:deploy] *********** DEPLOYMENT SUCCEEDED ***********
    [sf:deploy] Finished request 0Af29000001K8MECA0 successfully.

    BUILD SUCCESSFUL
    Total time: 1 minute 28 seconds

Log shows everything deployed successfully but in the below screenshot it shows zero:

enter image description here

Also here is my package.xml contents present inside the src/classes directory:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <version>31.0</version>
</Package>

EDIT:

Here is my directory structure as requested in the comments:

john@john:~/mm_workspace/my_SFDC_Project$ tree -R
.
├── ant_deploy
│   ├── build.properties
│   ├── build.xml
├── salesforce.schema
└── src
    ├── classes
    │   ├── some_class.cls
    │   ├── some_class.cls-meta.xml
    │   └── package.xml
    ├── objects
    ├── package.xml
    └── pages
        ├── some_page.page
        └── some_page.page-meta.xml

Could somebody please help me on what is wrong I am doing here? Thanks!

8
  • It's probably a combination of allowMissingFiles=true, and your specified deployRoot. I don't see any <sf:retrieve> in the target definition that you provided. Are you sure that ../src/Classes (which would be the path relative to the basedir specified in the ANT project definition) exists and contains the .cls and .cls-meta files?
    – Derek F
    Commented Feb 18, 2016 at 16:26
  • I tried removing the allowMissingFiles=true and still same result. Also I ran the command ls ../src/classes/ from the directory where I am running ant command and I do see that .cls and .cls-meta.xml files exist.
    – javanoob
    Commented Feb 18, 2016 at 16:36
  • Ok, now what is the basedir specified in the project definition? It might help if you edited your question to include more of your build.xml
    – Derek F
    Commented Feb 18, 2016 at 16:43
  • You need to deploy from your /src directory, not /src/classes. ANT is treating /src/classes like your /src directory, so it is looking in /src/classes/classes for .cls files. Commented Feb 18, 2016 at 16:51
  • @frontendloader, What do you recommend to deploy just classes folder I don't want to deploy everything in the src folder because of size issues as mentioned above.
    – javanoob
    Commented Feb 18, 2016 at 16:53

1 Answer 1

3

The ANT migration tool looks for .cls files inside of the classes directory directly below the directory specified in deployRoot. The way your target is set is making ANT look in ../src/classes/classes/ for .cls files.

You'll want to create an ANT copy task to copy your classes folder and package.xml to a different parent directory, and set the deployRoot to that parent directory.

2
  • Great! It is working. Thanks so much for your time.
    – javanoob
    Commented Feb 18, 2016 at 17:26
  • It's also probably a good idea to clean up that copied directory after the deployment with a <delete dir="foo"> task. It also might help to delete the copy dir after a deployment failure (in case some classes need to be excluded.), but I haven't figured out how to accomplish that one yet.
    – Derek F
    Commented Feb 18, 2016 at 17:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .