You can select one of the following options:
Detect automatically This is a default option. When you select this option, IntelliJ IDEA automatically detects the location of the generated sources. IntelliJ IDEA also detects which directory to mark as a source root. However, IntelliJ IDEA searches for the generated sources only in target/generated-sources and target/generated-sources/* directories.
target/generated-sources This option enables you to mark the directory as source root manually.
subdirectories of "target/generated-sources" This option enables you to mark a subdirectory as a source root manually.
Don't detect This option lets you skip the detection process.
Take a look at the <add-source>
build goal (see an example here)
Quote:
<plugin><groupId>org.codehaus.mojo</groupId><artifactId>build-helper-maven-plugin</artifactId><version>1.4</version><executions><execution><id>add-wsdl-source</id><phase>generate-sources</phase><goals><goal>add-source</goal></goals><configuration><sources><source>${basedir}/src-generated/src</source></sources></configuration><!-- [...] --></execution></executions></plugin>
You could define the (external) source directory as an dependency to your module. Project Structure -> Modules -> Depenencies
. There you have to add a new JAR or Directory
dependency.