Building a collection of packages together

AttributeTypeDescriptionPackage Types Applicable
buildCollectionarrayBuild a collection of packages together, even if only one package among the collection is changed
  • unlocked
  • org-dependent unlocked
  • source
  • diff


In certain scenarios, it's necessary to build a new version of a package when any package in the collection undergoes changes. This can be accomplished by utilizing the buildCollection attribute in the sfdx-project.json file.

To ensure that a new version of a package is built whenever any package in a specified collection undergoes a change, you can use the buildCollection attribute in the sfdx-project.json file. Below is an example illustrating how to define a collection of packages that should be built together.

{
  "packageDirectories": [
    {
      "path": "core",
      "package": "core-package",
      "versionName": "Core 1.0",
      "versionNumber": "1.0.0.NEXT",
      "default": true,
      "<a data-footnote-ref href="#user-content-fn-1">buildCollection</a>": [
        "core-package",
        "featureA-package",
        "featureB-package"
      ]
    },
    {
      "path": "features/featureA",
      "package": "featureA-package",
      "versionName": "Feature A 1.0",
      "versionNumber": "1.0.0.NEXT"
       "<a data-footnote-ref href="#user-content-fn-1">buildCollection</a>": [
        "core-package",
        "featureA-package",
        "featureB-package"
      ]
    },
    {
      "path": "features/featureB",
      "package": "featureB-package",
      "versionName": "Feature B 1.0",
      "versionNumber": "1.0.0.NEXT",
      <a data-footnote-ref href="#user-content-fn-1">"buildCollection": [</a>
        "core-package",
        "featureA-package",
        "featureB-package"
      ]
    }
  ],
}