0

I am trying to deploy the source code from this website - http://advancedapex.com/samplecode/ . For Third edition book version 1.0. I downloaded the zip file and extracted it. I got the Src file which I placed in the force.com ant migration tool folder. Path salesforceAnt/Sample/RetrieveUnpackaged/src. The same folder has package.xml. All these files can be found at the link I provided.

I assumed that to push the src code to my dev org all I need to do is place these files at the right place i.e. salesforceAnt/Sample/RetrieveUnpackaged/src and run ant deployUnpackaged command. But I get an error that deployment failed:

All the components failed except the custom object(It has *). Below is a generic error I get:

package.xml (AppConfigSupport) -- Error: An object 'AppConfigSupport' of type ApexClass was named in package.xml, but was not found in zipped directory

All the apex class, trigger, validation rule etc whatever present in package.xml failed with the above error( substitute the name and type of the component)

I was unable to deploy. Any idea why this error came up?

1 Answer 1

3

The default values for deploy is to assume that there is a single package (singlePackage="true"). In other words, your file structure should look exactly as follows:

└───retrieveUnpackaged
    │ package.xml
    ├───classes/*
    ├───objects/*
    ├───staticresources/*
    └───triggers/*

However, if you placed it in src, that means your file system probably looks like:

└───retrieveUnpackaged
    │ package.xml
    └───src
        ├───classes/*
        ├───objects/*
        ├───staticresources/*
        └───triggers/*

This will not work. package.xml must be in the same folder as classes, objects, and other folders.

If you want to keep src, you can, but make sure that package.xml is in the correct location:

└───retrieveUnpackaged
    └───src
        │ package.xml
        ├───classes/*
        ├───objects/*
        ├───staticresources/*
        └───triggers/*

Also, in order to support this type of deployment, you must also specify singlePackage="false", which tells the system that there is a further level of folders that describe (potentially) multiple packages.


All this said, I would say that you're probably wasting your time. Take the original zip file unmodified from the web site, go to https://workbench.developerforce.com/, Login using OAuth to your org (Sandbox, Developer, and Production orgs are supported), go to Metadata > Deploy, upload the zip file using the Single Package option checked, and you're done.

The Metadata Toolkit, while it was a novel idea for its time, has been superseded by more powerful tools. You should ideally look into DX, Force.com IDE, MavensMate, IntelliJ, Workbench, or any of a number of other tools that are far more powerful and are easier to use.

1
  • Hi, I got the zip file from the website. Did not modify it and used workbench. I get an error - problem: No package.xml found . Wondering if the structure should be changed inside the zip file?
    – Arnold
    Commented Dec 21, 2017 at 14:06

You must log in to answer this question.

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