Trouble importing multi module maven project in to Eclipse (STS 2.5.2)

99封情书 提交于 2019-12-03 08:48:09

M2Eclipse does a very good job at resolving inter-project dependencies. If it doesn't work, perhaps your project structure has errors. Check that:

  • every child project references the correct version of the parent project
  • every dependency has the version that corresponds to the current project version in the workspace
  • every child project is registered as a <module> in the parent pom (profile must be active if the module is defined in a profile).

If these versions don't match, the artifacts referenced will be pulled from the local repository, not the eclipse workspace.


About common root projects: I don't think it's a good idea to have a common Project, but the Eclipse concept that comes to mind (and that I use for multi-module projects) is a Working Set.

In the Package Explorer, switch the Top Level Elements to Working Sets:

Now choose Configure Working Sets ... from the same menu.

Here's a working set with the maven3 trunk and all submodules as separate projects:

Dmytro

Ugly trick - but sometimes can help:

  • mvn clean eclipse:clean eclipse:eclipse
  • Import projects as usual Eclipse project
  • enable Maven's Dependency Management
  • Perform Update Project Configuration for all modules
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!