I am exploring a model where I codegen one .iml file per package in IntelliJ. For example, suppose I have the packages com.example.foo, com.example.foo.bar, and com.example.foo.baz. That means that in the .iml file for com.example.foo, I need:
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$"
isTestSource="false"
packagePrefix="com.example.foo" />
<excludeFolder url="file://$MODULE_DIR$/bar" />
<excludeFolder url="file://$MODULE_DIR$/baz" />
</content>
Every time I add a new “sub-package” of com.example.foo, I have to add a new <excludeFolder> element to <content>. Is there any way to avoid this and just say “my source directory is the immediate directory and none of the subdirectories?”
Source root configuration is recursive, it’s not possible to configure just a directory as Sources while excluding all its subdirectories.