Cannot create more than 1 module using the same connection

Issue #900 resolved
Piotr Kożuchowski created an issue

Problem: I have nested modules in my project, but I cannot set the same connection I use for the main project on the modules. After selecting the same connection, I'm getting popup that connection could not be resolved.

Here's my use case:

Due to how Salesforce retrieves metadata (profiles, objects etc). and how inconvenient it is to manage that in repository, we are trying new approach.

In the main project I will only have certain metadata - Apex Classes, pages, aura components - metadata which is always retrieved as a whole and deploying this file would always override. Let's call this overriding metadata.

Then I have modules which contain CR specific metadata - profiles with certain fields, objects with certain fields etc. The point is, I can deploy this module as if it was a change set with all my changes regarding that CR and I could refresh this module from Dev sandbox and the module would still contain only metadata related to that CR.

How it looks like - let's say I have a client called JohnDoe which we have been maintaining for years and there's new CR to create a new community with some logic (There's little to no dependency with current code base, but the sandbox is the same and repository is the same). Our project would look like this:

  • JohnDoeDev - root of the project / main module
    • modules
      • CommunityCR
        • src
          • classess
          • pages
          • profiles
          • objects
          • permissionsets
    • src
      • aura
      • classess
      • pages
      • triggers

Comments (8)

  1. Scott Wells repo owner

    Piotr, this is a bug that I've hit as well. There's a workaround, albeit a bit goofy. I'll go ahead and provide it in case it helps until I get the proper fix in place. Basically in your org you create an unmanaged development package per-module, and in the IC project configuration screen, you choose the proper development package for each module in addition to the shared connection. IC will then "remember" the module/development package/connection combo properly. Note that this does not at all imply that you're developing packages. It will just make things work the way that you're wanting.

    Oh, and you should also make sure to set up the module dependencies properly to get proper symbol resolution across module boundaries. Let me know if you're not sure how to do that.

  2. Piotr Kożuchowski reporter

    Thanks for quick reply :) Changed this to minor since it's experimental approach and we are only trying it on one project at the moment. Another workaround that I'm using atm is to duplicate connection and use the clone for module.

  3. Scott Wells repo owner

    Yep, and another one is to use multiple source roots in a single module instead of a multiple modules. That's how you'd have to do this in WebStorm which doesn't support multi-module projects, and it works quite well. I also recommend that you split out your test classes into a separate test source root. I do that in all of my projects now.

  4. Scott Wells repo owner

    Take a look at this and see whether it helps or not:

    https://www.jetbrains.com/help/idea/sources-tab.html

    In a single module you can have one or more content roots, and each content root can have one or more source roots. Each source root can be designated as Sources (production source code), Tests (test source code), Resources and Test Resources, and Excluded. What you'd do is set up a single module with a content root atop what you currently have configured as multiple modules, then add each src directory as a source root. And like I said, if you can it's nice to separate out your test classes into their own Tests source root.

    Let me know if that doesn't help.

  5. Scott Wells repo owner

    Issue tracker grooming. If this is still an issue, please feel free to reopen, ideally with a concrete reproduction scenario.

  6. Log in to comment