11

Given two unlocked packages: UP_A and UP_B. UP_B classes uses classes from UP_A (UP_B depends on UP_A).

When I try to create a new version to UP_B from terminal I get the message:

ClassFromUP_B: Invalid type: ClassFromUP_A

My understanding is since ClassFromUP_A belongs to UP_A its source code shouldn't be part of the UP_B.

What Am I misunderstanding?

Further Info

My sfdx-project.json:

{
    "packageDirectories": [
        {
            "path": "atlas-quantum",
            "default": true,
            "package": "atlas-quantum",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT"
        }
    ],
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "46.0",
    "packageAliases": {
        "[email protected]": "04t1K000002uwEIQAY",
        "[email protected]": "04t1K000002uwENQAY",
        "atlas-quantum": "0Ho1K000000k9cQSAQ",
        "[email protected]": "04t1K000002uwCRQAY",
        "[email protected]": "04t1K000002uwCWQAY"
    }
}
  • atlas-quantum is my project that depends on fflib-apex-common
  • fflib-apex-common depends on fflib-apex-mocks

Error message I get when I try to create atlas-quantum package version: Assets: Invalid type: fflib_SObjectDomain,Assets: Invalid type: fflib_SObjectDomain,Application: Invalid type: fflib_Application.SelectorFactory,Application: Invalid type: fflib_Application.DomainFactory,Application: Invalid type: fflib_Application.SelectorFactory,Application: Invalid type: fflib_Application.DomainFactory,AssetsSelector: Invalid type: fflib_SObjectSelector,AssetsSelectorTest: Dependent class is invalid and needs recompilation: Class AssetsSelector : Invalid type: fflib_SObjectSelector,Assets: Invalid type: fflib_SObjectDomain.IConstructable

IMPORTANT: the code is working properly in the scratch org.

3
  • 2
    Can you share your sfdx-project.json? Aug 4, 2019 at 13:53
  • @MohithShrivastava updated with sfdx-project.json. Thank you for the quick reply!
    – Saulo
    Aug 4, 2019 at 14:30
  • 1
    @MohithShrivastava you're the best! Thank you so much man!!
    – Saulo
    Aug 4, 2019 at 15:53

1 Answer 1

11

From the documentation you will need to specify dependency using dependencies property in the project-sfdx.json.

{
  "packageDirectories": [
    {
        "path": "atlas-quantum",
        "default": true,
        "package": "atlas-quantum",
        "versionName": "ver 0.1",
        "versionNumber": "0.1.0.NEXT",
        "dependencies": [
            {
               "package": "[email protected]"

            },
            {
               "package" : "[email protected]"
            }
        ]
    }
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "46.0",
"packageAliases": {
    "[email protected]": "04t1K000002uwEIQAY",
    "[email protected]": "04t1K000002uwENQAY",
    "atlas-quantum": "0Ho1K000000k9cQSAQ",
    "[email protected]": "04t1K000002uwCRQAY",
    "[email protected]": "04t1K000002uwCWQAY"
   }
}

You must log in to answer this question.

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