Confusing gradle auto-detection of sourcesets
Currently I use gradle's auto-import feature with my project and I've noticed some strange behavior with specifying sourcesets and using a test directory.
Please see the screenshot below noting the arrows.

My framework necessitates a "srcTest" folder that is automatically picked up (which is good) based on the logic inside of some dependent gradle config that I apply at the top of my build.gradle file. I also have a separate test file however for non-framework related tests that I just place in a folder "test" (not pictured). That test folder also necessitates the use of the resources file present in the actual source (src), so I specify resources.srcDirs to that folder. For some reason, this makes IDEA think that my com package is actually my test module which leads to lots of other issues related to my IDE and testing.
Could someone explain to me why this happens and how to correct? I'd be happy to provide any other potentially relevant information if it would be helpful - just ask. Thanks.
Please sign in to leave a comment.
With Settings(Preferences) | Build, Execution, Deployment | Build Tools | Gradle | Create separate module per source set option enabled IDE creates separate module for each Gradle source set. Since you have such source set defined in build.gradle it creates the module for it.
IDE model with the separate module for a source set more corresponds to a Gradle model because Gradle sets a separate classpath for each source set, exactly how IDE does for a module. See http://mrhaki.blogspot.com/2016/03/gradle-goodness-source-sets-as-intellij.html