Eclipse + Maven + Git +多模块项目=不快乐 [英] Eclipse + Maven + Git + Multi-Module projects = Unhappiness

查看:169
本文介绍了Eclipse + Maven + Git +多模块项目=不快乐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用Eclipse和Maven的多模块项目。过去我唯一可以使它工作的方法是在项目中使用平面布局,父模块与其他模块对等。这对于m2eclipse和Subversion来说可以正常工作。



现在我们想转到Git和GitHub。我想将整个项目和所有模块一起公开,作为GitHub上的一个项目。问题是,EGit,Eclipse / Git插件,想要一次管理项目,而不是项目组,所以如果你有一个平坦的布局,你不能这样做。



正确的答案是使用标准的Maven分层布局,并将父级和所有模块作为一个单元进行管理。但是,Eclipse并不喜欢Eclipse,并且没有任何数量的虚拟化将使Eclipse接受嵌套项目。 m2Eclipse不支持层次结构: https://issues.sonatype.org/browse/MNGECLIPSE-2291



那么你做什么?从命令行执行Git并放弃在Eclipse中查看哪些文件已更改的功能?或放弃Eclipse?

解决方案

一个标准的Maven多模块结构作为一个单一的git repo在Eclipse Indigo中对我来说完美无缺M2e和在该环境中显示的git插件。您不能要求Eclipse为您提取,但是一旦您从命令行中删除,您就可以使用Team / Share,说Git!,一切都很好。



我想我看到了什么来源:层次结构是工作空间中项目的问题,而不是您导入的现有项目。



这是一个典型的工作流程:


  1. 使用git svn clone获取树。它是eclipse中的一个库存,分层mvn多模块树

  2. ,使用import / maven / existing maven项目。指向整棵树

  3. 选择所有

  4. 确定

它工作正常。嵌套不会影响日食一点。我不知道bz指向什么问题。



在我使用m2e之前,我使用了maven-eclipse-plugin。而且它也在这些情况下起作用,因为它不会为<$​​ c $ c>< packaging> pom< / package> 聚合项目生成.project / .classpath,因此Eclipse从未被称为实际上嵌套任何东西。



我不是一个人 - 请参阅开发人员设置说明作为cxf.apache.org,您可以为自己尝试一个开源示例。


We've got a multi-module project using Eclipse and Maven. The only way I could get it to work in the past was to use a flat layout for the projects, where the parent module was a peer to the other modules. This worked fine with m2eclipse and Subversion.

Now we'd like to move to Git and GitHub. I'd like to expose the entire project, along with all the modules, as a single project on GitHub. The problem is that EGit, the Eclipse/Git plugin, wants to manage projects one at a time, not groups of projects, and so if you've got a flat layout, you can't do it.

The right answer is to use a standard Maven hierarchical layout and manage the parent and all the modules as a unit. But Eclipse doesn't like that, and no amount of fiddling will get Eclipse to accept nested projects. m2Eclipse does not support hierarchies: https://issues.sonatype.org/browse/MNGECLIPSE-2291

So what do you do? Do Git from the command line and abandon the ability to see what files have changed in Eclipse? Or abandon Eclipse?

解决方案

A standard Maven multi-module structure as a single git repo works perfectly fine for me in Eclipse Indigo with M2e and the git plugin that shows up in that environment. You can't ask Eclipse to do your fetching for you, but once you've pulled from command line, you use Team/Share, say 'Git!' and all is well.

I think I see what's the source: hierarchy is a problem for projects inside the workspace, not 'existing projects' that you import.

Here's a typical workflow:

  1. use git svn clone to get a tree. it's a stock, hierarchical mvn multi-module tree
  2. in eclipse, use import/maven/existing maven project. Point at the whole tree
  3. select all
  4. OK

it works fine. The nesting does not disturb eclipse one bit. I don't know what problem that bz is pointing at.

Before I used m2e I used the maven-eclipse-plugin. And it also worked in these cases, because it does not generate a .project/.classpath for <packaging>pom</packaging> aggregating projects, so Eclipse is never called upon to actually nest anything.

I'm not alone -- see the developer setup instructions as cxf.apache.org for an open source example that you can try for yourself.

这篇关于Eclipse + Maven + Git +多模块项目=不快乐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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