简体   繁体   中英

Egit + m2e with parent pom: problems with eclipse workspace

my projects layout is the following:

luna-pom
|
|------luna-core
|       |--pom.xml
|------luna-fx
|       |--pom.xml
|
|------pom.xml

My Git repository was initialized in the projects main folder. I then added the git repository to the EGit repository view, and choosed 'Import Maven Projects'. Although the layout of the project is unusual for eclipse, it still managed to import the projects correctly. However, only the parent-pom project is connected to the git repository. This means i can't commit / push on the subprojects. While i understand that this may cause problems with git, I still would like to see what files i changed so far.

This is what my workspace looks like now:

在此处输入图片说明

Is there anyway to do this? Is this a bug, or expected behaviour?

Thanks in advance!

fr1zle

Well this is a little bit of all: a bug, expected behaviour and you can get around this.

1) It is a bug: it is just way too annoying the way it works now to consider this acceptable. Hopefully Eclipse 4 will bring a set of new features (mainly the possibility to handle the fact that the same file can be present several times in the workspace) that will allow m2e and Egit to work a lot better

2) It is expected: this is all known to both Egit and M2E teams and they can't really solve this currently.

3) Work-around:

  • If you right click on a project, you can do right-click on your projects (which are modules of your Maven project)
  • select Share Project....
  • Select "Git" and the "Next".
  • At the top of the Wizard, you will see a checkbox "Use or create repository in parent folder of project": Check that box and press Finish.

This is not the best solution but it works, you will be able to see the modified file. However, commit dialog will not select the selected files of the package explorer. Synchronize should almost never be used because there are some severe performance issues which makes your workspace unusable after that. It also seems that on large project Egit has some severe issues.

Personnaly, I use EGit to commit, fetch/pull and switch branches. I do the rest on the Command line as I find it much faster and I understand a lot better what is actually going on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM