3

What if I want all the classes EXCEPT a few?

For example, if I have a scheduled batch that definitely won't deploy, how would I say "not that" but not have to manually name all the other ones?

Caveats...this is via Jenkins GitHub plugin,, not mavens or eclipse.

1
  • I'm not sure there is anything you can do via the package.xml itself, but perhaps you can script something to automate a package.xml creation with metadata references and exclude the ones you know you can't deploy. Jan 4 '14 at 19:46
3

Unfortunately ant migration tool does not look at includes / excludes attributes or elements.

If it's a regular thing, how about using ant to snip it out of your package.xml on the fly?

<target name="almostDeploy">
    <!-- put yo stuff away -->
    <replace file="src/package.xml"
    token="&lt;members&gt;YOUR_CLASS_HERE&lt;/members&gt;"
    value="&lt;!--members&gt;YOUR_CLASS_HERE&lt;/members--&gt;" />

    <!-- normal salesforce deploy -->
    <sf:deploy
    username="${sf.username}"
    password="${sf.password}"
    serverurl="https://login.salesforce.com"
    deployRoot="src"/>

    <!-- put stuff back yo -->
    <replace file="src/package.xml"
    token="&lt;!--members&gt;YOUR_CLASS_HERE&lt;/members--&gt;"
    value="&lt;members&gt;YOUR_CLASS_HERE&lt;/members&gt;" />
</target>
2
  • 2
    Nice tweak! To get use of the Ant exclude/include filters back one could copy files to be deployed to a temp folder using the filters and leverage wildcards in the package.xml as well. Bit more work then your nice use of replace above, but maybe a thought if the requirement grows more complex. Jan 5 '14 at 23:18
  • Very clever, 320. You're the winner. Jan 6 '14 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.