1

I'm trying to deploy an Apex Class from one org to another. I get this error:

All Component Failures: 1.package.xml -- Error: No package.xml found

package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Test1234</members>
        <name>ApexClass</name>
    </types>
    <version>33.0</version>
</Package>

build.properties

# build.properties
#

# Specify the login credentials for the desired Salesforce organization sf.username = sf.password =
#sf.pkgName =
#sf.zipFile =
#sf.metadataType =

# Use 'https://login.salesforce.com' for production or developer edition (the default if not specified).
# Use 'https://test.salesforce.com for sandbox.

sf.serverurl = https://login.salesforce.com sf.maxPoll = 20
# If your network requires an HTTP proxy, see http://ant.apache.org/manual/proxy.html for configuration.
#

build.xml file

<project name="Jenkins CI Demo" xmlns:sf="antlib:com.salesforce">

    <property file="C:\TestDeploy\build.properties"/>
    <property environment="env"/>


    <target name="deploy">

        <sf:deploy   username="${sf.username}"
                     password="${sf.password}"
                     serverurl="${sf.serverurl}"                     
                     maxPoll="${sf.maxPoll}"
                     logType="Detail"
                     deployRoot="C:\TestDeploy\src\"/>

    </target> 


</project>
  • 1
    Make sure you're referring to correct working directory. build.xml, build.properties and package.xml should be in same directory. – Rohit Mourya Nov 13 '17 at 16:28
  • 1
    I think you need to include more information about your deployment for this question to be answerable. – Adrian Larson Nov 13 '17 at 16:29
  • sure i will edit my question – user50839 Nov 13 '17 at 16:37
  • I think you're missing this attribute unpackaged="package.xml" in your sf:deploy. You can have a look at sample build.xml and build.properties. – Rohit Mourya Nov 13 '17 at 16:50
  • when i'm trying to execute with unpackaged="package.xml" i got sf:deploy doesn't support the "unpackaged" attribute – user50839 Nov 13 '17 at 16:56
1

The package.xml file must be at your deployRoot ("C:\TestDeploy\src\package.xml"). It must be exactly named package.xml (case sensitive). The format of your metadata source directory should look like this:

\---src
    |   package.xml
    |
    \---classes
            Test1234.cls
            Test1234.cls-meta.xml

Edit:

It seems that you also need to use singlePackage in order for the structure above to work:

    <sf:deploy   username="${sf.username}"
                 password="${sf.password}"
                 serverurl="${sf.serverurl}"                     
                 maxPoll="${sf.maxPoll}"
                 logType="Detail"
                 singlePackage="true"
                 deployRoot="C:\TestDeploy\src\"/>

It seems it may have been "false" by default before, or maybe it's just been too long since I've used it, but when singlePackage is false, it specifies an extra layer in your file system, like this:

\---src
    \---package
        |   package.xml
        |
        \---classes
                Test1234.cls
                Test1234.cls-meta.xml
  • i used same structure what you are displayed in the above.but still i got the same error like All Component Failures: 1.package.xml -- Error: No package.xml found and also displayed lot of apex classes are displayed with Not in package.xml. i want to deploy only one apex class insted of all is there any way to do this please – user50839 Nov 13 '17 at 17:14
  • @bashask Try adding singlePackage="true" to your build.xml (shown in the edited version of this answer). – sfdcfox Nov 13 '17 at 17:24
  • thanks @sfdcfox but in real time how can i do this process automatic with jenkins insted of manually deploying process with changes. i can deploy the meta data from one org to other but at changes deploying time it automates all metadata again. i need only changes deployment is there any idea – user50839 Nov 13 '17 at 17:51
  • @bashask You'll have to write a script or use some sort of tool. Ant migration toolkit and/or Jenkins by itself won't build a custom package.xml that contains only what you want. This question may help you. – sfdcfox Nov 13 '17 at 20:30

Your Answer

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