m2eclipse是否取消了多模块的支持?
与大多数 spring+hibernate 企业案例一样,我想将 Dao、Service、Web 层分离到不同的模块中,以便我可以在前端和管理网站中同时重用 Dao 层。问题是我发现 m2eclipse 不能很好地支持这个多模块项目,有什么解决方案吗?
我正在使用 eclipse 3.7 和 Sonatype m2eclipse,我有一个典型的多模块结构项目,一个抽象父模块,2 个子模块(A 和 B)。我可以从父级运行“package”,但是当我在 system.out 等任何对象后输入“点”时,我无法得到提示,并且它显示“此编译单元不在 Java 项目的构建路径上”。此外,在 A 的 pom.xml 中设置依赖项后,我无法从 B 调用 A 中的方法。
我在这里发现了一个非常类似的问题 问题在eclipse中运行maven项目,不被识别为Java项目,但这并不能解决我的问题。我听说 m2eclipse 已经删除了对多模块项目的支持,但这种需求非常普遍,我 100% 确定一定有某种解决方案。
谢谢。
我通过将整个项目和子模块也作为单独的项目导入来使其工作。我发现在个别项目中我可以获得提示提示方法并进行调试,但我使用整个项目的 pom 来构建。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
m2e 中仍然支持多模块,我不知道您从哪里听说它已被删除,但这是完全错误的。
您只需将子模块导入为现有的 Maven 项目即可。
另请查看 http://www.sonatype.com/books/m2eclipse-book/reference/creating-sect-importing-projects.html#fig-creating-import-multi
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