如何在Eclipse中设置/导入多maven模块SVN连接项目的最佳方法是什么?

时间:2020-12-19 23:59:56

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.

我在Windows 7 64位PC上使用Eclipse(3.4.2 *),m2eclipse(0.9.8),Subversive(0.7.9)和SVNKit(1.6.10)。

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中设置(导入,真正)多模块maven项目提供一些建议,同时仍满足以下要求吗?

  1. 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应该为每个子模块维护一个项目(如果我没记错的话,颠覆性插件甚至不再支持单个项目中的嵌套模块)。

  2. 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).

    Eclipse应该将所有java文件识别为正确的java类(即,它们应该可以使用“Open Type”对话框找到,以及Eclipse中的所有其他常规java函数,如显示类型/调用层次结构)。

  3. 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.

    使用文件搜索或“打开资源”对话框时,应排除所有目标文件夹和.svn文件和文件夹,并且应在导航器中排除/隐藏所有svn文件夹。

  4. The "Open Resource" should not display any single file more then once.

    “开放资源”不应再显示任何单个文件。

  5. When I open a file using the "Open Resource" or "Open Type" dialog, I should be able to see the svn-history for it.

    当我使用“打开资源”或“打开类型”对话框打开文件时,我应该能够看到它的svn-history。

  6. I should be able to do an svn switch on the entire maven project (ie including all sub modules) in one single step.

    我应该能够在一个步骤中对整个maven项目(即包括所有子模块)进行svn切换。

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).

我遇到的主要问题是需求2. Eclipse似乎并不理解java文件是正确的java类,除非它在子模块中找到它们。要做到这一点,虽然仍然满足要求4,但在配置我的工作集时,我必须在主eclipse项目中排除一堆文件夹。但后来我打破了要求5,因为Eclipse将在子模块项目中打开java文件,并且该项目未连接到SVN。如果我尝试通过将子模块项目连接到SVN来解决这个问题,我就打破了需求6(如果我在主项目上进行切换,则子模块项目仍然认为它们已连接到旧的分支/主干)。

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.

有什么想法/建议?改变项目的核心结构不是一种选择。我曾尝试搜索之前关于此主题的讨论,但它们似乎都只涉及问题的一部分(例如“我如何在eclipse中隐藏svn文件/文件夹?”或“Open Type找不到某些类”)和没有覆盖整个eclipse + SVN + maven项目的子模块。

*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.

*我仍然使用这个版本的原因是,据我所知,对于Eclipse平台本身没有简单的,开箱即用的升级功能(对于3.4.x版本),我讨厌必须执行全新安装,然后手动设置我想要的一切并安装所有插件。

1 个解决方案

#1


3  

I think if you do the following you will get everything you want.

我想如果你做以下事情,你会得到你想要的一切。

  1. From the repository explore checkout the parent project. IE the one containing the modules.
  2. 从存储库中探索结帐父项目。 IE包含模块的那个。

  3. After checking out the project won't look right so delete it. DO NOT delete the sources.
  4. 签出后项目看起来不对,所以删除它。不要删除来源。

  5. Then do a file > import and import the parent project folder.
  6. 然后执行文件>导入并导入父项目文件夹。

You should then see the parent and modules as separate projects and most (if not all) the requirements you listed should be fulfilled.

然后,您应该将父项和模块视为单独的项目,并且应该满足您列出的大多数(如果不是全部)要求。

#1


3  

I think if you do the following you will get everything you want.

我想如果你做以下事情,你会得到你想要的一切。

  1. From the repository explore checkout the parent project. IE the one containing the modules.
  2. 从存储库中探索结帐父项目。 IE包含模块的那个。

  3. After checking out the project won't look right so delete it. DO NOT delete the sources.
  4. 签出后项目看起来不对,所以删除它。不要删除来源。

  5. Then do a file > import and import the parent project folder.
  6. 然后执行文件>导入并导入父项目文件夹。

You should then see the parent and modules as separate projects and most (if not all) the requirements you listed should be fulfilled.

然后,您应该将父项和模块视为单独的项目,并且应该满足您列出的大多数(如果不是全部)要求。