Sources and Resources
In general, IDEA automatically imports sources and resources as Sources folders (or Test Sources for test sources and resources). E.g. in case:
However, IDEA does not support nested directories; it is also not allowed to use same directory as production sources and test sources or as sources and resources. If you need some common code, consider extracting it into a separate folder.
The following configurations are incorrect:
In order to get generated sources automatically imported as source folders configure corresponding plugins so that they put them into target/generated-sources/<subdir>, where subdir is any folder name you prefer. The subdir folder is necessary to distinguish sources from different tools and also to exclude some special generated sources (e.g. groovy stubs).
Please note that even if you manually configure some source folders under target/generated-sources of this folder itself, IDEA will rewrite them according to your pom.xml.
Any time you want to generate sources you simply execute the corresponding goal, bound for generation (usually generate-sources, generate-test-sources). After that IDEA will pick up new folders and set them up.
Generated Sources in Non-standard location
If it is not possible to configure the plugin you should use Update Folders action available from Maven Projects tool window and for each Maven project in the list. This action takes special steps to discover plugin configuration and configure source folders.
To specify a phase that should be used during this action go to Settings->Maven->Import.