6

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": {
        "fflib-apex-mocks@0.1.0.1": "04t1K000002uwEIQAY",
        "fflib-apex-common@0.1.0.1": "04t1K000002uwENQAY",
        "atlas-quantum": "0Ho1K000000k9cQSAQ",
        "atlas-quantum@0.1.0-1": "04t1K000002uwCRQAY",
        "atlas-quantum@0.1.0-2": "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.

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

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": "fflib-apex-mocks@0.1.0.1"

            },
            {
               "package" : "fflib-apex-common@0.1.0.1"
            }
        ]
    }
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "46.0",
"packageAliases": {
    "fflib-apex-mocks@0.1.0.1": "04t1K000002uwEIQAY",
    "fflib-apex-common@0.1.0.1": "04t1K000002uwENQAY",
    "atlas-quantum": "0Ho1K000000k9cQSAQ",
    "atlas-quantum@0.1.0-1": "04t1K000002uwCRQAY",
    "atlas-quantum@0.1.0-2": "04t1K000002uwCWQAY"
   }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.