I am having problem importing Gradle project with subprojects into IntelliJ 2019.2. Our team builds .IML module files outside of IJ. We use iml.withXml clause to change XML properties; test source folders, etc. Additionally, we set outputFile to './idea' to collect .IML files in one place.
When pointed at ../src or build.gradle, IJ does not load generated .IML module files. Once opened, source folders are marked incorrectly, mostly everything is a source folder. For example, src/testingWidgets folder must be a test, not source.
I found a workaround
1. File-Settings->Gradle, check "Generate .IML files for modules imported from Gradle". IJ takes a few seconds to rewrite .IML files, removing our XML modifications. At this point, IJ seems to be watching IML files.
2. In Gradle tab, I execute idea task. IJ is now reading and interpreting .IML file correctly.
How can I make IJ recognize generated IML module files on opening without doing #1, #2?
PS. For legacy reason, we can't switch to recommended IJ SourceSet per Module setting yet.