6

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.

Community
  • 1
  • 1
barfuin
  • 16,865
  • 10
  • 85
  • 132
  • 1
    I do also have a problem with the new behaviour. We do code coverage analysis and the plugins (`scoverage`) creates two additional `sourceSets`. This `main` works fine after import but the `test` source are not recognised properly. After I delete the additional modules from `Project Structure > Modules` everything works fine again. – alexvetter Apr 01 '16 at 08:12
  • That's not a solution to this problem but I didn't found another way. Problem, after refreshing the gradle project the additional modules reappear! We don't use the `idea` plugin for gradle. – alexvetter Apr 01 '16 at 08:14

1 Answers1

5

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

alexvetter
  • 1,998
  • 2
  • 16
  • 42