.idea/MyModule.iml should not reference the project directory in the jdkName because it prevents sharing/checking in the iml file

Issue #1839 resolved
Eric Kellstrand created an issue

tldr: Illuminated cloud puts the workspace root folder name in the jdk definition in MyModule.iml, meaning you can’t share/checkin MyModule.iml

Steps:

  1. Checkout project into /code/MyWorkspace1
  2. Load/create project in IntelliJ ( I tried with Webstorm and Idea )
  3. Checkin ./idea/* (except workspace.xml and any subdirectories)
  4. Checkout project into /code/MyWorkspace2 (On your machine or another. The important bit is the different path)
  5. load the project in IntelliJ

Expected: IntelliJ is happy, and IlluminatedCloud doesn’t need to change the jdkName in MyModule.iml

Actual: Illuminated Cloud prompts user to select a valid JDK, and then changes .idea/MyModule.iml with the new value - which now checks out the file every time you pull the code.

Notice MyWorkspace1 in the snippet below. Maybe this could be changed to $MODULE_DIR$ ?

<module type="IlluminatedCloud" version="4">
  ...
  <component name="NewModuleRootManager">
    ...
    <content url="file://$MODULE_DIR$">   ...    </content>
    <orderEntry type="jdk" jdkName="IlluminatedCloud (MyWorkspace1/FullCopy)" jdkType="IlluminatedCloud" />
  </component>
</module>

Comments (4)

  1. Scott Wells repo owner

    Eric, assuming that the modules are stored under the project directory, and that the source roots are under the module's content roots, everything should be relative. For example, here's a pretty extensive configuration from my one of my own projects:

    <?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="demo" />
            <option name="connectionType" value="OAUTH" />
            <option name="defaultSourceRootUrl" value="file://$MODULE_DIR$/force-app/main/default" />
            <option name="moduleContents">
              <ModuleContents>
                <option name="contentSelectionType" value="PACKAGE_XML" />
                <option name="packageXmlRelativePath" value="manifest/package.xml" />
              </ModuleContents>
            </option>
          </configuration>
        </facet>
      </component>
      <component name="ModuleRunConfigurationManager">
        <shared />
      </component>
      <component name="NewModuleRootManager">
        <content url="file://$MODULE_DIR$">
          <sourceFolder url="file://$MODULE_DIR$/config" isTestSource="false" />
          <sourceFolder url="file://$MODULE_DIR$/manifest" isTestSource="false" />
          <sourceFolder url="file://$MODULE_DIR$/scripts" isTestSource="false" />
          <sourceFolder url="file://$MODULE_DIR$/force-app/main/default" isTestSource="false" />
          <excludeFolder url="file://$MODULE_DIR$/.sfdx/tools/sobjects" />
          <excludeFolder url="file://$MODULE_DIR$/.sfdx/typings" />
          <excludeFolder url="file://$MODULE_DIR$/out" />
        </content>
        <content url="file://$MODULE_DIR$/out" />
        <orderEntry type="jdk" jdkName="IlluminatedCloud (df17-with-manifest/demo)" jdkType="IlluminatedCloud" />
        <orderEntry type="sourceFolder" forTests="false" />
      </component>
    </module>
    

    All paths there are set up for portability.

    Can you explain in more detail exactly what kind of paths you're ending up with in your .iml file that aren't portable? I apologize but I'm not understanding from the existing information.

  2. Eric Kellstrand Account Deactivated reporter

    Am I tripping over Webstorm’s (lack of) module management. For the moment, I don’t have module subdirs under my workspace. It looks like this:

    /code/MyWorkspace1/
    ├───.idea
    ├───force-app
    │ └───main/…..
    ├───IlluminatedCloud
    │ ├───Sandbox
    │ └───Prod
    └───manifest

    /code/MyWorkspace2/

    What does your directory structure look like? specifically around your ‘.idea’ and ‘df17-with-manifest’ directorys

  3. Scott Wells repo owner

    Eric, while WebStorm doesn't explicitly expose the concept of modules, it does actually have a single module under-the-hood. The project shown above works fine in WebStorm, PhpStorm, etc., as well as in IntelliJ IDEA.

    First, here's another relevant file, .idea/modules.xml which identifies the module file location:

    <?xml version="1.0" encoding="UTF-8"?>
    <project version="4">
      <component name="ProjectModuleManager">
        <modules>
          <module fileurl="file://$PROJECT_DIR$/df17-with-manifest.iml" filepath="$PROJECT_DIR$/df17-with-manifest.iml" />
        </modules>
      </component>
    </project>
    

    The project directory structure is:

    • /path/to/projectRoot/ (generally projectRoot is named df17-with-manifest but can be named anything because everything else is relative)
      • .idea/
        • illuminatedCloud.xml
        • modules.xml
        • ...
      • .sfdx/
      • .vscode/
      • config/ - configured as a source root, though for config files and not metadata
      • force-app/main/default/ - configured as a source root and designated as the default source root
      • manifest/ - configured as a source root, though for config files and not metadata

    There are many other projects as peers under /path/to/ that are independent.

    Does that help?

  4. Scott Wells repo owner

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

  5. Log in to comment