Unable to create modules in complex project subdirectory and module structure


My company's software build system, because language-heterogeneous, creates a "sandbox" system that's difficult to integrate into an IDEA project. Attempting to File -> New -> Module from existing sources to make module1 leads to main.iml and test.iml with main and test subdirectories in bold in the Project view. Of course, I expect module1 and module2 to be in bold after and I expect module1.iml and module2.iml.



Project set-up:

project                     --root in IntelliJ

`-- code

   +-- pom.xml

   `-- component        --will not have own source code; just subsumes multiple modules

       +-- pom.xml

       +-- module1       -- cannot get IDEA to make this a module

       |    +-- pom.xml

       +   `-- src          (main/java, test/java, etc.)

       `-- module2       -- cannot get IDEA to make this a module

            +-- pom.xml

            `-- src          (main/java, test/java, etc.)


Mistake on line

+    `-- src

change to

|     `-- src


Try importing pom.xml files instead.


I guess I'm new enough to IntelliJ that I don't know what that means. Do you mean dump the project (erase .idea) and re-open by selecting the top-level pom.xml or something more surgical?


Yes, just open the root pom.xml to import the project from Maven.


This didn't work because only code has a pom.xml and not the sandbox root (code's parent), which I need because it's got pre-built resources in it I have to use (which I did not show you--not your fault).

However, by expanding the right-edge Maven Projects view, clicking + and adding module1 solves the problem once I then go into Project Settings and arrange everything. I think this is the "surgical" version of what you were suggesting.

Thank you very much!


Please sign in to leave a comment.