麻烦将多模块maven项目导入Eclipse(STS 2.5.2) [英] Trouble importing multi module maven project in to Eclipse (STS 2.5.2)

查看:323
本文介绍了麻烦将多模块maven项目导入Eclipse(STS 2.5.2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发送最后一个小时查看Stackoverflow.com上的线程,试图将一个Maven项目导入到Spring ToolSuite 2.5.2。



Maven项目有多个模块,当我使用STS中的导入...向导导入项目所有模块都列在包资源管理器中,并且某些模块依赖关系未解决。



对于将多模块Maven项目导入STS / Eclipse的正确方法,可以提供任何建议,以便模块都显示在父目录下?
所有的模块依赖关系都解决了吗?



项目位于文件系统上的层次结构
我已经尝试过各种更新依赖关系,项目配置选项,但全部无济于事。
我有一个安装在IDE中的Maven的嵌入版本。



感谢您的时间。

解决方案

M2Eclipse在解决项目间依赖关系方面做得很好。如果它不起作用,也许你的项目结构有错误。检查:




  • 每个子项目引用父项目的正确版本

  • 每个依赖项都每个子项目中工作区中的当前项目版本对应的版本

  • 在父级中注册为< module> pom(如果模块在配置文件中定义,配置文件必须处于活动状态)。



如果这些版本不匹配,将从本地存储库中删除,而不是eclipse工作区。






关于常用根项目:我不认为有一个共同的项目的好主意,但是想到的Eclipse概念(我用于多模块项目)是一个工作集。 >

在包资源管理器中,将顶级元素切换到工作集





现在从同一个菜单中选择配置工作集...



这是一个工作集,maven3中继线和所有子模块作为单独的项目:




I've just sent the last hour looking at threads on Stackoverflow.com trying to import a Maven project in to Spring ToolSuite 2.5.2.

The Maven project has multiple modules, when I use the Import... wizard in STS to import the project All the Modules are listed in the Package Explorer and some of the modules dependencies are not resolved.

Can any advise on the proper way to import a Multiple Module Maven project in to STS/Eclipse such that the modules all appear under a Parent directory? And so all the modules dependencies are resolved?

The project is in a hierarchy on the file system I've tried the various Update Dependencies, Project Configuration options but all to no avail. I have an embedded version of Maven installed in the IDE.

Thanks for your time.

解决方案

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:

这篇关于麻烦将多模块maven项目导入Eclipse(STS 2.5.2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆