Advanced Project Configuration Parameters for Second-Generation Managed Packages

As your managed 2GP package development becomes more complex, consider including these optional parameters in your sfdx-project.json file.
Name Details
apexTestAccess Required? No

Default if Not Specified: None

Assign permission sets and permission set licenses to the user in context when your Apex tests run at package version creation.
"apexTestAccess": {
               "permissionSets": [
                   "Permission_Set_1",
                   "Permission_Set_2"
               ],
               "permissionSetLicenses": [
                   "SalesConsoleUser"
               ]
           }

See Specify Unpackaged Metadata or Apex Access for Package Version Creation Tests for Second-Generation Managed Packages

branch Required? No

Default if Not Specified: None

If your package has an associated branch, but your package dependency is associated with a different branch, use this format.
"dependencies": [
    {
    "package": "pkgB",
    "versionNumber": "1.3.0.LATEST",
    "branch": "featureC"
   }
]

If your package has an associated branch, but your package dependency doesn’t have an associated branch, use this format.

"dependencies": [
    {
    "package": "pkgB",
    "versionNumber": "1.3.0.LATEST",
    "branch": ""
    }
]

See Use Branches in Second-Generation Managed Packaging

dependencies Required? No

Default if Not Specified: None

Specify the dependencies on other packages.
To specify dependencies for managed packages within the same Dev Hub, use either the package version alias or a combination of the package name and the version number.
"dependencies": [ 
   {
      "package": "MyPackageName@1.1.0.1"
   }
]
"dependencies": [ 
   {
      "package": "MyPackageName",
      "versionNumber": "1.1.0.RELEASED"
   }
]
To specify dependencies for managed packages outside of the Dev Hub use:
"dependencies": [ 
   {
      "package": "04txxx"
   }
]

To set the dependency, you can use the keywords RELEASED or LATEST for the version number.

To denote dependencies with package IDs instead of package aliases, use:

  • The 0Ho ID if you specify the package ID along with the version number
  • The 04t ID if you specify only the package version ID
If the package has more than one dependency, provide a comma-separated list of packages in the order of installation. For example, if a package depends on the package Expense Manager - Util, which in turn depends on the package External Apex Library, the package dependencies are:
"dependencies": [
   {
      "package" : "External Apex Library - 1.0.0.4"

         },
   {
      "package": "Expense Manager - Util",
      "versionNumber": "4.7.0.RELEASED"

   }
]

See: Considerations for Promoting Packages with Dependencies

postInstallScript Required? No

Default if Not Specified: None

An Apex script that runs automatically in the subscriber org after the managed package is installed or upgraded.
postInstallURL Required? No

Default if Not Specified: None

A URL to post-install instructions for subscribers.
releaseNotesUrl Required? No

Default if Not Specified: None

A URL to release notes.
scopeProfiles Required? No

Default if Not Specified: false

The scopeProfiles parameter is a child of packageDirectories. If you set scopeProfiles to true for a package directory, profile settings from only the package directory being packaged are included, and profile settings outside of that package directory are ignored.

When you set scopeProfiles to false (the default value), the new package version includes relevant pieces of profile settings in any package directory defined in sfdx-project.json.

unpackagedMetadata Required? No

Default if Not Specified: None

See Specify Unpackaged Metadata or Apex Access for Package Version Creation Tests for Second-Generation Managed Packages.
uninstallScript Required? No

Default if Not Specified: None

An Apex script to run automatically in the subscriber org before the managed package is uninstalled.