Newer Version Available

This content describes an older version of this product. View Latest

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.
1"apexTestAccess": {
2               "permissionSets": [
3                   "Permission_Set_1",
4                   "Permission_Set_2"
5               ],
6               "permissionSetLicenses": [
7                   "SalesConsoleUser"
8               ]
9           }

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.
1"dependencies": [
2    {
3    "package": "pkgB",
4    "versionNumber": "1.3.0.LATEST",
5    "branch": "featureC"
6   }
7]

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

1"dependencies": [
2    {
3    "package": "pkgB",
4    "versionNumber": "1.3.0.LATEST",
5    "branch": ""
6    }
7]

See Use Branches in Second-Generation Managed Packaging

calculateTransitiveDependencies Required? No

Default if Not Specified: false

Enables the calculation of the package’s indirect dependencies. A package can have multiple levels of dependencies, where pkgC depends on pkgB, and pkgB depends on pkgA, for example. By default, you list all of a package’s dependencies, including indirect (transitive) dependencies. When calculateTransitiveDependencies is set to true, you specify a package’s direct dependencies only, and the indirect dependencies are calculated for you. See the dependencies parameter’s description for example configurations in the sfdx-project.json file.

calculateTransitiveDependencies also enables you to generate a hierarchical graph of a package version’s dependencies. To generate the dependencies graph, run the package version displaydependencies CLI command. See package version displaydependencies in the Salesforce CLI Command Reference.

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.
1"dependencies": [ 
2   {
3      "package": "MyPackageName@1.1.0.1"
4   }
5]
1"dependencies": [ 
2   {
3      "package": "MyPackageName",
4      "versionNumber": "1.1.0.RELEASED"
5   }
6]
To specify dependencies for managed packages outside of the Dev Hub use:
1"dependencies": [ 
2   {
3      "package": "04txxx"
4   }
5]

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:
1"dependencies": [
2   {
3      "package" : "External Apex Library - 1.0.0.4"
4
5         },
6   {
7      "package": "Expense Manager - Util",
8      "versionNumber": "4.7.0.RELEASED"
9
10   }
11]
If you set the calculateTransitiveDependencies parameter to true, you specify the package’s direct dependencies only, and the indirect (transitive) dependencies are calculated for you.
For example, if calculateTransitiveDependencies is enabled and the package depends on the package Expense Manager - Util, which in turn depends on the package External Apex Library, the package dependency is:
1"dependencies": [
2   {
3      "package": "Expense Manager - Util",
4      "versionNumber": "4.7.0.RELEASED"
5
6   }
7]
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.