When I run the ant migration tool, it is editing my package.xml file. Weirdly, all it is doing is re-arranging it -- moving tags around -- but it concerns me because it doesn't seem like running the process should edit the configuration files at all.

Is this an expected behavior?

How do I prevent the ant migration tool from editing package.xml? Is there are reason I would want it to change package.xml?

I am keeping package.xml checked into version control, or else I wouldn't have noticed this.

  • 1
    Unfortunately, I don't have anything to cite this, so not making it an answer. This is to be expected. After several years of deployments and VCS struggles, I've seen ANT re-order and update the package.xml after retrieve many times. I believe it orders it by type alphabetically. A positive of this is if you have two types with the same name it will merge them.
    – zainogj
    Feb 26, 2018 at 22:18
  • At first I didn't think it was alphabetizing, but now I realize it's ASCII alphabetizing -- putting all capital letters before all lower case letters. Feb 26, 2018 at 22:43

1 Answer 1


If package.xml is the source, and is in the destination/retrieve folder, it'll be updated. Otherwise, if it's elsewhere, or it has a different name, it won't be.

This is a part of the metadata API, and not unique to the migration tool. The migration tool itself just unzips whatever the API returns.

  • Is it reasonable to just add /path/to/retrieveTarget/package.xml to the project's .gitignore and keep my package.xml in a different directory? Feb 27, 2018 at 16:03
  • @NathanHinchey Maybe. Keep in mind that to deploy, your package.xml must contain all of the elements to deploy, which typically means you'll want to use the one you get back from a retrieve, or build your own.
    – sfdcfox
    Feb 27, 2018 at 16:11
  • When would the one I get from retrieve be different from the one I use for the retrieve? Feb 27, 2018 at 16:16
  • 1
    @NathanHinchey Because of wild cards, misspelled/missing elements (warnings), different case-sensitive sorting of the named members or names. The API returns a very specific order.
    – sfdcfox
    Feb 27, 2018 at 16:24

You must log in to answer this question.

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