+ Start a Discussion
Steve ChadbournSteve Chadbourn 

Deployment - Packaging vs Ant & Issues

We are attempting our first deployment from a dev sandbox to a qa sandbox and are experiencing major issues.
We have all sorts of files we are trying to deploy including visualforce pages, apex classes, custom objects, custom fields on standard objects, page layouts, record types, picklist changes etc.
We first tried to deploy as much as possible using a package. Because it is a sandbox we can only create unmanaged packages. If we add a class, any referenced fields are added to the package. When we try and deploy the package it fails if any fields already exist. Does using managed packages get round this?
Next we tried using the ant deployment tool. We need to use this for at least visualforce pages as they can't be packaged yet. Deployment order seems to matter hugely for ant deployments. If I try and deploy Class A that references Class B and Class B has not yet been deployed it fails. How do I tell ant what order to deploy things in? My manifest (package.xml) has wildcards for each type - should I name every file and order them? Surely not.
My main issue with ant relates to the page/controller cross reference - how can I deploy either pages or controllers when they cross reference each other?
Besides these two ways I can't see any other way of deployment. There is Eclipse but it used the same API calls that ant uses so same deployment order problem.
Surely someone must have worked through this. I have searched the boards but can't see suggestions.
Any ideas anyone?
Steve ChadbournSteve Chadbourn


I'm sure someone must have come up against these issues - is it that no-one has a good solution?



Did you come up with a suitable method of deploying pages/controllers that reference each other?

Steve ChadbournSteve Chadbourn

Yes. We have written our own deployment program. There are still things that we can't deploy in this manner but it works with pages/controllers (we can't deploy for example button overrides)..

We are also using it in place of the Eclipse auto-build - our save time is down from 60 secs to 5 secs. We had previously blamed out proxy/firewall for this but as our save is so quick it must be something else Eclipse (or the Salesforce plug-in) is doing.

Something like this is seriously needed from Salesforce as it is a huge hole in the lifecycle. We shouldn't have to write our own tools to do this.


Hi Steve,


I know this is a little late, but I'm trying to write a simple plugin for my preferred IDE that when a file is saved it would publish it to salesforce org.   It looks like you've done something similar.


Would you be able to share this code with me?




"For your case using managed package wont make any difference .Even with managed package also you face same issue.
When working with ant tool i.e. Ant Migration tool follow below best practices.Make sure your package.xml file should follow the order its dependencies  would be deployed first.
Deployment best practices:
Profiles have a lot of information in them and they depend on other objects being in the destination org when they are deployed. If the deployment can be broken up in pieces, this can be a way to simplify the process. Custom objects and new fields can be pushed first as they do not depend on anything. Then the code and Visualforce pages along with validation rules, workflow and approvals can be pushed. Finally profiles can be pushed now that all of the dependent object for a profile are in place. Expect the pushing of the profiles to be a tricky process. In some cases a profile may even need to be created manually from scratch.

SSE , Salesforce CI expert group