views:

432

answers:

2

In our project we are using jaxb2-maven-plugin to generate Java source code from XML Schema, which causes that our Maven module requires additional source code directory (in our case target/generated/main/java). Up to date I've been using Eclipse and maven-eclipse-plugin to import all the projects into Eclipse workspace. The plugin is (somehow) able to add the directory with generated source code automatically to Eclipse' .classpath file.

Recently I try to switch to (play with?) IntelliJ IDEA 9 (so I am a newbie in this environment) and I've noticed that additional source directory is not added during IDEA's importing process...

Is there any way I can configure IDEA/Maven to make importing directory with generated source code automatically?

A: 

Try with maven-jaxb2-plugin. If it does not work then it's IDEA problem.

In Maven you can add new source roots per configuration. Maven plugins can do this programmatically. This is for sure the case with maven-jaxb2-plugin. Then, if IDEA does not recognize it, then it's a problem on that side.

lexicore
+1  A: 

The convention with Maven is to generate code in target/generated-sources/<tool>, for example target/generated-sources/jaxb2

Follow this convention and IDEA will add the folder as source folder (see IDEA-53198).

Pascal Thivent

related questions