如何在 Eclipse 中设置/导入多 Maven 模块 SVN 连接的项目?
我在 Windows 7 64 位 PC 上使用 Eclipse (3.4.2*)、m2eclipse (0.9.8)、Subversive (0.7.9) 和 SVNKit (1.6.10)。
有人可以就如何在 Eclipse 中设置(实际上是导入)多模块 Maven 项目提供一些建议,同时仍然满足以下要求吗?
根据一般建议,Eclipse 应该为每个子模块维护一个项目(如果我没记错的话,颠覆性插件甚至不再支持单个项目中的嵌套模块)。
Eclipse 应该将所有 java 文件识别为正确的 java 类(即,应该可以使用“Open Type”对话框以及 Eclipse 中的所有其他常规 java 功能找到它们,例如显示类型/调用层次结构)。
使用文件搜索或“打开资源”对话框时,应排除所有目标文件夹以及 .svn 文件和文件夹,并且应在导航器中排除/隐藏所有 svn 文件夹。
“打开资源”不应多次显示任何单个文件。
当我使用“打开资源”或“打开类型”对话框打开文件时,我应该能够看到它的 svn 历史记录。
我应该能够一步对整个maven项目(即包括所有子模块)进行svn切换。
项目结构,简单来说:
<main project folder>
|
|
---- pom.xml
|
|
---- module 1
| |
| |
| --- pom.xml
| --- src/main/java
|
---- module 2
[...]
我遇到的主要问题是需求 2。Eclipse 似乎不理解 java 文件是正确的 java 类,除非它在子模块中找到它们。为此,在仍然满足要求 4 的同时,我必须在配置工作集时排除主 Eclipse 项目中的一堆文件夹。但后来我打破了要求 5,因为 Eclipse 将打开子模块项目中的 java 文件,并且该项目未连接到 SVN。如果我尝试通过将子模块项目连接到 SVN 来解决这个问题,我就会违反要求 6(如果我在主项目上进行切换,子模块项目仍然认为它们已连接到旧分支/主干)。
有什么想法/建议吗?改变项目的核心结构不是一个选择。我曾尝试搜索有关此主题的先前讨论,但它们似乎都只涵盖了问题的一部分(例如“如何在 eclipse 中隐藏 svn 文件/文件夹?”或“Open Type 找不到某些类”)和没有一个涵盖了带有子模块的 eclipse + SVN + maven 项目的整个范围。
*我仍然使用这个版本的原因是,据我所知,Eclipse 平台本身没有简单的、开箱即用的升级功能(对于 3.4.x 版本来说),而且我讨厌这样做执行全新安装,然后按照我想要的方式手动设置所有内容并安装所有插件。
I use Eclipse (3.4.2*), m2eclipse (0.9.8), Subversive (0.7.9) and SVNKit (1.6.10) on a Windows 7 64-bit PC.
Can someone give some advice on how to set up (import, really) a multi module maven project in Eclipse, while still fulfilling below requirements?
Eclipse should maintain one project for each sub module, according to the general recommendations (if I remember correctly the subversive plugin doesn't even support nested modules in one single project anymore).
Eclipse should recognice all java files as proper java classes (ie they should be findable using the "Open Type" dialog, as well as all other normal java functionallity in Eclipse, like displaying type/call hierarchy).
All target-folders and .svn files and folders should be excluded when using the file search or "Open Resource" dialog, and all svn-folders should be excluded/hidden in the Navigator.
The "Open Resource" should not display any single file more then once.
When I open a file using the "Open Resource" or "Open Type" dialog, I should be able to see the svn-history for it.
I should be able to do an svn switch on the entire maven project (ie including all sub modules) in one single step.
The project structure, in simple terms:
<main project folder>
|
|
---- pom.xml
|
|
---- module 1
| |
| |
| --- pom.xml
| --- src/main/java
|
---- module 2
[...]
The main problem I have is with requirement 2. Eclipse doesn't seem to understand that the java files are proper java classes unless it finds them in the sub modules. To do that, while still fullfilling requirement 4 I must exclude a bunch of folders in main eclipse project when configuring my Working Set. But then I break requirement 5, since Eclipse will then open the java file in the sub module project, and that project is not connected to SVN. And if I try and fix that by connecting the sub module project to SVN I break requirement 6 (if I do a swich on the main project, the sub module projects still thinks they are connected to the old branch/trunk).
Any thoughts/suggestions? Changing the core structure of the project is not an option. I have tried searching for previous discussions on this topic, but they all seem to cover only a part of the problem (like "how do I hide svn files/folders in eclipse?" or "Open Type does not find some classes") and none cover the entire span of eclipse + SVN + maven project with sub modules.
*The reason I still use this version is that there is no easy, out-of-the-box upgrade function for the Eclipse platform itself as far as I know (for version 3.4.x, that is), and I hate having to perform fresh install and then manually setting up everything the way I want and installing all plugins.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想如果你做到以下几点,你就会得到你想要的一切。
然后,您应该将父项目和模块视为单独的项目,并且您列出的大多数(如果不是全部)要求都应该得到满足。
I think if you do the following you will get everything you want.
You should then see the parent and modules as separate projects and most (if not all) the requirements you listed should be fulfilled.