Working with Gradle and Module Groups


I'm trying to migrate from v12 to v14. I have quite complex modules structure where individual source modules are grouped into module groups.

|  +--m1
|  +--m2
|  +--m3
|  +--m4
|  +--m5
+--External Libraries

To replicate similar structure in Gradle I use the following = 'p'
include 'mg1:m1', 'mg1:m2'
include 'mg2:m3', 'mg2:m4', 'mg2:m5'

When I import Gradle project into IDEA or when "Refresh all Gradle projects" is clicked the following happens:

  • Project folder becomes a module one:
  • +--p
    |  +--mg1
    |  |  +--m1
    |  |  +--m2
    |  +--mg2
    |  |  +--m3
    |  |  +--m4
    |  |  +--m5
    +--External Libraries

  • Module files (IML) are added for a project (p.iml) and for both module groups (mg1.iml and mg2.iml)

Both outcomes are not expected since modules groups are not intended to carry on sources or module files. Having "p" as top level module (it's a project though) unveils special folders like .gradle, build, etc that don't add any value but cluttering project inspector view.

Is this a bug? Or a feature? Is there a workaround to prevent changes to files and project view?

I use "$ gradle ideaModule" for project file generation and it works almost as expected but there are some related unconveniences with this approach.


1 comment
Comment actions Permalink

Any thoughts on this from JB team? It has been 3 years as we try-and-wait to import various Gradle projects into IDEA and it still half-baked.


Please sign in to leave a comment.