3

This is kind of linked to my other question

How to Integrate github and Ant migration tool?

Here is my package.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomLabels</name>
    </types>
    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>
    <version>31.0</version>
</Package>

Here I did not specify the CustomObjects type intentionally because we are always working on the classes and triggers and there will be no changes in the Objects,profiles,permission sets..So I deleted those parts from the package.xml

And when I do the command ant deployUnpackaged It is trying to deploy everything to server and reports the below errors:

objects/Case.object (Case.OwnerId) -- Error: Not in package.xml

Any idea??

Thanks in Advance..

  • Did yo get solution to this issue? looks like it still has not been fixed by salesforce. What approach did you use? – apple123 Apr 18 '16 at 17:37
  • You posted your question as answer. Do you want to post your question as comment to my original question then I can respond to your question. – javanoob Apr 18 '16 at 17:39
  • Sorry as I did not have enough rep to comment I had to post is as an answer. – apple123 Apr 18 '16 at 17:42
  • 1
    Ok. Actually this is not a bug with the tool but this is how it works. Force migration tool tries to deploy everything that is present in the source or root folder. You can have components listed in the package.xml and not present in the folder with attribute allomissingfiles set to true but you cannot have other way. Solution for this is you can have a task in ant which will move the files you want to deploy to another folder and reference that folder in your deployUnpackaged or whatever target. Hope it is clear! – javanoob Apr 18 '16 at 17:50
  • can you elaborate more on that? As we have code coming from tfs and I am getting the package.xml configured from force.com IDE. Now everytime the developer changes something and wants to deploy to sandbox how will the ant task work? Based on the package.xml? Thank you for your time. – apple123 Apr 18 '16 at 17:53
2

When you deploy a folder, Ant is expecting the contents of src to be all listed in the package.xml. If it comes across metadata not listed, then it complains. If you don't want to deploy your objects, then you need to remove them from the src folder.

  • Is there an option to specify to exclude the folders objects,profiles,permissionsets? – javanoob May 4 '15 at 22:32
  • 1
    Nope. I guess you could write a script to move the things you want to another folder and then deploy that one instead? (In your build.xml, you'd change the deployRoot) – Daniel Hoechst May 4 '15 at 22:33
  • Thanks Daniel for the idea and thanks again for your time – javanoob May 4 '15 at 22:35

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.