Maven project import not setting correct source folder

Hi, we've just starting using Intellij 9 and already have an existing Maven project which we imported in.  The Maven project is quite complex with a top level pom and lots of modules with some in turn having sub modules.  I've imported the top level pom and Intellij has imported all the sub modules with separate .iml files for each one, so far so good.  However Intellij sets the wrong Root folder for the Source on most of the modules.  Our Source folder is one down from the project folder so ${basedir}/src.  We've set a sourceDirectory tag in the top level pom which will be inherited by the other poms if not explicitly set but Intellij does not pick this up.  Even when I add sourceDirectory to the module pom Intellij still will not set src as the Root folder.  However it does set subsequent levels in the package if I put that in the pom i.e.  <sourceDirectory>${basedir}/src/com</sourceDirectory>.  Not matter what variation of pattern I put in the <sourceDirectory> tag it won't set src as Root directory.  Is there something obvious I'm doing wrong here or is this a bug?   

2 comments
Comment actions Permalink

I've had the same issue. The problem is that you have multiple modules 'inheriting' the source folder from a parent pom.
But IntelliJ cannot have multiple modules sharing the same source.

I had to refactor our maving structure to fix this.

Christian

0
Comment actions Permalink

Thanks for the reply.  I've had a word with the Maven gurus here and it does make sense.  I think we are going to refactor our projects to src/main/java soon anyway which should resolve the issue.

0

Please sign in to leave a comment.