Support for non-standard DX directory structure

515 views
Skip to first unread message

Marcel Pękacki

unread,
Feb 1, 2021, 8:44:01 AM2/1/21
to Illuminated Cloud Q&A
Hi,
The standard DX directory structure is: force-app/main/default/classes etc.
However our project uses something like this:

force-app/foo/classes
force-app/bar/classes
force-app/baz/classes

SFDX CLI seems to work correctly with this non-standard structure (specifically, sfdx force:source:push and :pull commands), but unfortunately, Illuminated Cloud 2 seems to not recognize anything outside force-app/main/default/ (for example, code completion and checking does not work). As a workaround, I move everything to force-app/main/default, do development, and then move everything back to where it should be before I commit, but this is not very convenient. Is there any option to configure such non-standard paths?

Scott

unread,
Feb 1, 2021, 9:59:10 AM2/1/21
to Illuminated Cloud Q&A, Marcel Pękacki
Hi. Yes, Illuminated Cloud does support Salesforce DX's more flexible source format project structure. The critical part is configuring your project's content and source roots. My guess is that it's currently configured with force-app/main/default as the (only?) source root. You can change that using Illuminated Cloud>Configure Module under the Project Structure tab. Most likely you just need to have a single content root at the same level as the project's top-level directory and then add each of "force-app/foo", "force-app/bar", and "force-app/baz" (or whatever they really are) as the source roots. Note that you can also specify a distinction between production source roots and test source roots if you've created such a distinction. The IDE will actually use that information to treat production and test source separately.

Regards,
Scott Wells

Marcel Pękacki

unread,
Feb 1, 2021, 10:20:51 AM2/1/21
to Illuminated Cloud Q&A, Scott
Thank you, Scott! Works perfectly.

Scott

unread,
Feb 1, 2021, 10:38:08 AM2/1/21
to Illuminated Cloud Q&A, Marcel Pękacki, Scott
Glad to hear! Thanks for letting me know that it worked well for you.

Regards,
Scott

Paweł Iwanowicz

unread,
Mar 17, 2022, 6:31:16 PM3/17/22
to Illuminated Cloud Q&A, Scott
Hi Scott,

Sorry for dusting off this old topic, but I've got a similar problem. We've got a pretty complex structure for our unlocked package and I've tried to do configuration as you've described, however, every single time I'm trying to save any apex class I get an error "Deployment Complete Deployed 0/41 components to FridayUnlockedTest in 1 s 377 ms with status FAILED."

Projects' .iml file looks as follows:

<?xml version="1.0" encoding="UTF-8"?>
<module type="IlluminatedCloud" version="4">
  <component name="FacetManager">
    <facet type="IlluminatedCloud" name="Illuminated Cloud">
      <configuration>
        <option name="connectionName" value="FridayUnlockedTest" />
        <option name="connectionType" value="OAUTH" />
        <option name="defaultSourceRootUrl" value="file://$MODULE_DIR$/force-app" />
        <option name="moduleContents">
          <ModuleContents>
            <option name="contentSelectionType" value="PACKAGE_XML" />
            <option name="packageXmlRelativePath" value="manifest/package.xml" />
          </ModuleContents>
        </option>
      </configuration>
    </facet>
  </component>
  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/force-app" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/commons/core" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/commons/selectorLayer" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/commons/triggerHandler" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/main/default" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/main/domain" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/main/selectors" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/main/services" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/main/triggerHandlers" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/main/utils" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/manageResources" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/manageTimesheets" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/timesheetApprovals" isTestSource="false" />
    </content>
    <orderEntry type="jdk" jdkName="IlluminatedCloud (friday/FridayUnlockedTest)" jdkType="IlluminatedCloud" />
    <orderEntry type="sourceFolder" forTests="false" />
  </component>
</module>

As you can see, we've got plenty of folders marked as Source, however, this doesn't work (except for LWC, Objects, Layouts and a few other - those components seem to save without any problems). Below is a sample screenshot of what the folders look like:
2022-03-17_23h27_36.png

Any help would be much appreciated :)

Best regards,
Paweł Iwanowicz.

Scott

unread,
Mar 17, 2022, 10:04:10 PM3/17/22
to Illuminated Cloud Q&A, Paweł Iwanowicz, Scott
Hi. I'm not 100% sure if this is it, but you have overlapping source roots, e.g.:

      <sourceFolder url="file://$MODULE_DIR$/force-app" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/force-app/commons/core" isTestSource="false" />

Notice that the first is an ancestor of the second (and pretty much all of the others). Please remove that as a source root and, if you're still having issues, I'll likely need to get deployment debug logs from you so I can see better what's happening under the hood.

Regards,
Scott Wells

Paweł Iwanowicz

unread,
Mar 18, 2022, 3:41:45 AM3/18/22
to Illuminated Cloud Q&A, Scott
Hi Scott,

I've marked the first one as"Resources" because I thought that by "content root" you've meant exactly that. After a while, I was able to find the source of this issue - we've built the unlocked package with a namespace and we were trying to deploy changes by mistake to the wrong environment (not the one on which the package was developed but to the one on which it was installed). Now everything is working ok - sorry for the trouble (lessons learned :) ).

Best regards,
Paweł. Iwanowicz

Scott

unread,
Mar 18, 2022, 10:18:06 AM3/18/22
to Illuminated Cloud Q&A, Paweł Iwanowicz, Scott
Ah, okay. That makes sense. As for content roots and source roots, you can find much more detail on that here:


I'm glad you figured out your issue, though. Thanks for circling back around and letting me know.

Regards,
Scott Wells

Reply all
Reply to author
Forward
0 new messages