> Having dirs with generated sources under "target" is a common situation,
so I'm surprised that it isn't handled smoothly by the IntelliJ/Gradle
combo.
In Eclipse/Maven generated source dirs under "target" are automatically
added as source folder upon import of a Maven project. For most (Maven)
plug-ins generating sources this works out of the box, for others one can
explicitly add the source source folder in the Maven POM so it will be
recognized during IDE import.
Maybe a similar approach exists for Gradle?
Like I said initially, the import does already mark the generated source
dirs as sources. That is not the problem. The problem is IntelliJ's
notion of "excluded dirs" which allows users to tell IntelliJ to not scan
those dirs; think of it as an "ignore" flag.
The trouble is that the import marks the Gradle build dir (our target dir)
as excluded. So even though the directories under target are marked as
source, it is irrelevant because the parent dir has been marked excluded.