Search code examples
javaeclipsem2eclipse

Is the support of multi-module of m2eclipse removed?


Like in most spring+hibernate enterprise cases, I want to separate Dao, Service, Web layers into different modules, so that I can reuse Dao layer simultaneously in front-end and admin web site. The issue is I found m2eclipse does not support this multi-module project very well, any solutions?

I'm using eclipse 3.7 and Sonatype m2eclipse, I have a typical multiple-module structure project, one abstract parent, 2 children modules(A and B). I can run "package" from the parent, but I can not get hint when I input a "dot" after any object like system.out, and it says "This compilation unit is not on the build path of a Java project." Moreover, I can not invoke methods in A from B after I set dependencies in A's pom.xml.

I found a very similar issue here Issues with maven project running in eclipse, not recognized as Java project, but which does not solve my problem. I heard m2eclipse has removed this support for multiple-module project, but the need is so common that I'm 100% sure that there must be some kind of solution.

Thanks.

I got it working by importing the whole project and sub-module as individual projects as well. I find in individual projects I can get prompt hint methods and debug, but I'm using the whole project's pom to build.


Solution

  • Multi-module is still supported in m2e, I don't know where you heard that was removed but that's utterly wrong.

    You simply need to import your sub modules as existing maven projects.

    Also take a look at http://www.sonatype.com/books/m2eclipse-book/reference/creating-sect-importing-projects.html#fig-creating-import-multi