3

I am trying to exclude a file (which is in the deployment root folder) from being deployed to a sandbox. Does ant have any sort of attribute to achieve this?

<target name="deploy">
  <sf:deploy username="${sf.username}" password="${sf.password}${sf.token}"
    serverurl="${sf.endpoint}" maxPoll="${sf.maxPoll}" deployRoot="../src"
    rollbackOnError="true" autoUpdatePackage="true" purgeOnDelete="true"
    logType="Debugonly" allowMissingFiles="true" ignoreWarnings="true"
    pollWaitMillis="10000" />
</target>

deployRoot is referring to src folder which has a subfolder - salesforce settings folder. There are few types of settings we include in that folder, I want to exclude knowledge.settings file from being deployed. I don't want to delete the file from that folder.

2

1 Answer 1

2

The Ant Migration Tool itself does not have the capability to do that. It basically just zips the directory, calls the metadata deploy() call, waits for the results, and parses the response. It doesn't do anything else to the files directly, including checking that there are no missing files, no extra files, etc. It's very bare-bones and does only minimal processing. This allows the complicated part to be done on the server without maintaining a lot of code client-side.

The next best solution would be to use some Ant built-in tasks to copy the deploy root to a temporary directory, excluding files you don't want, modify the package.xml to remove the lines of code related to it, and finally deploy the temporary directory, followed by an optional cleanup of the temporary files. I'm not going to write out the full solution, but it'll start out like this:

<target ...>
  <copydir ... />
  <replaceregexp .../>
  <sf:deploy ... />
</target>

You must log in to answer this question.

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