[SalesForce] Generating package.xml for deploying with Ant from Eclipse

I'm using Ant to deploy from within Eclipse and facing a challenge of having to manually manage my package.xml files.

Currently I am unhappy that I a) have to manually manage my package.xml entries and b) can only deploy all objects in my project.

So these are separate but possibly related problems:

  1. Can eclipse or the force.com plugin automatically generate the package.xml file for me?
    In some of my projects it is there and contains objects, in others it is empty. A refresh from server does not change it. I would expect it to at least contain all subscribed objects.

  2. The sf:deploy target complains if there are files in the folder which are not in package.xml If I want to deploy only selected objects I have to manually generate a package.xml and make a new folder with only those classes.

  3. Is there a way in ant to have targets use a different package.xml?

[target name="deployAll"]
[sf:deploy username="${sf.username}" package="package.xml"/]
[/target]

[target name="deployBasic"]
[sf:deploy username="${sf.username}" package="package.basic.xml"/]
[/target]

If anyone else is also using Ant I would appreciate some tips.

Best Answer

I am using ant together with Jenkins and indeed you need to generate the package.xml yourself or use that one from the eclipse project.

I found this salesforce migration guide very usefull to see what you can add in the ant script to retrieve/deploy

http://www.salesforce.com/us/developer/docs/daas/salesforce_migration_guide.pdf