intellij-ideagradleintellij-idea-2016

Control automatic creation of IDEA modules from Gradle sourceSets in 2016.1?


Starting with IntelliJ IDEA 2016.1, IDEA automatically creates IntelliJ modules from Gradle SourceSets (link). While I recognize that this was a major step forward for many reasons, it is also a major change for existing projects which relied on IDEA being source set agnostic. I currently get over 50 new modules that I don't want ...

Do you know of a way to restore IntelliJ's old behavior?

Is there a way to control how modules are created from source sets, for example by excluding a sourceset?

I already checked the Gradle IDEA plugin docs but could not find a solution. I also tried this but it seems to apply only to multi-module projects, not to the source set problem.
I am using Gradle 2.12 and, obviously, IDEA 2016.1.


Solution

  • Currently there is no way of controlling the automatic creation of modules based on projects sourceSets.

    There are quite a lot issues regarding this problem:

    https://youtrack.jetbrains.com/issue/IDEA-153231

    https://youtrack.jetbrains.com/issue/IDEA-154014

    https://youtrack.jetbrains.com/issue/IDEA-153264

    Edit:

    Since IntelliJ IDEA 2016.1.2 (I think) there is a new option "Create separate module per source set" on "Import Project from Gradle" dialog:

    enter image description here