How can I make IDEA recognize my generated sources using Gradle?

This isn't specifically a Gradle question, but that's what I'm using as my build tool, so it's relevant.  I'm having the same problem as these people:

Once I exclude the 'build' directory from a project module, it's impossible for me to get IDEA to pick up any sources underneath that directory.  The GUI makes it look like it's going to do what I want, but it doesn't.  I'll attach a couple screenshots.



In the first screenshot you can see that 'generated-sources/thrift' is marked as a source folder.  However, I have to manually remove the 'build' folder from the excludes list before IDEA will pick up any sources in the 'generated-sources/thrift' folder.  Since the sources are generated I would prefer if I could keep them hidden from the project view.

In my opinion the GUI is indicating things are going to behave the way I want, but the excludes always override my source folders.  If it's supposed to be impossible to use a sub-directory of an excluded folder as a source folder, the GUI shouldn't let me select both at the same time.

Please sign in to leave a comment.