3

Although managed packages automatically include new metadata components which are explicitly referenced by one of the components in the existing package, I frequently find myself manually adding new test classes to the package after deploying them to the packaging org.

My question is, is it possible to automatically include new metadata components in a first-generation package when deploying the new metadata into the publisher org? Perhaps through some configuration in the meta.xml file?

I should note that I've tried adding a <fullName> tag to the test class' meta.xml file, but observed that the class was still not added to the package despite its namespace being correctly populated.

UPDATE I've unsuccessfully tried deploying via package.xml with a <fullName> parameter, here's the package.xml:

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

Here's the result in the packaging org: enter image description here

Here's a screenshot of the name for sanity check: enter image description here

1 Answer 1

0

Yes, you can: the key is the package.xml file, though, not your individual -meta-xml files.

If your package.xml include a fullName component with the name (not namespace) of the target package, components you deploy will be added to the package, e.g.,

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>YourPackageName</fullName>
3
  • I've commented the result of my test, maybe the issue is my use of sfdx force:source:deploy ? Going to test with sfdx force:mdapi:deploy to see if any difference in result. Jun 3, 2020 at 21:38
  • Yeah, I was assuming you were using Metadata API format. I don't know that you can do this in source format.
    – David Reed
    Jun 3, 2020 at 21:40
  • Found success with the mdapi command, thank you. Jun 3, 2020 at 21:44

You must log in to answer this question.

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