0

after a couple of hours trying and reading a number of tutorials, I can't fix the following problem: I have a remote server running a git repository. From eclipse (neon.2 and egit) I pushed several maven projects, each with its own pom.xml to this repository. When a friend of mine, who wants to co-develop tries to setup his environment, also using Eclipse Neon.2 and egit, we are not able to reproduce the setup in the Package Explorer. We get all the sources but in one project. The original maven projects are all nested in this one project. This wrong setup results in a couple of problems when trying to compile or run the projects.

We used File-> Import-> Git-> Projects from Git-> Clone URI. In Source Git Repository we pointed the Repository path to /home/git/workspace.git. In the Branch Selection dialog we can then only see the master. In the following Local Destination dialog we checked the Clone submodules checkbox. We played around with the following options to run wizards which were all failing, so we ended up with this one project option in the bottom of the three options in the dialog.

What is not happening, is the import projects dialog as explained here https://wiki.eclipse.org/EGit/User_Guide/Remote#Import_Projects (but this seems to be a former version, since the Clone submodules checkbox is missing in the dialog before on this web page)

Can anybody please tell us how to extract the maven projects as top elements in eclipse, linked to the existing git repository, such that we can work as a team?

Should you need any additional information, please let me know.

Thank you in advance.

Alex
  • 1,387
  • 2
  • 9
  • 14
  • You should have separate git repos for each project. – 1615903 Mar 14 '17 at 07:54
  • These maven projects make use of each other. So if I split them out onto several git repositories I run into the problem, that the maven projects may run out of sync. The way it is on my computer currently, is if I make a change in one of the maven projects that has an impact in another one, I make that change in the other maven project but the beauty is that if I update the git repository (merge, push) both maven projects are updated in one go. I would appreciate to keep this mechanics. Any ideas? – Alex Mar 14 '17 at 10:10
  • Submodules is the way to solve your issue of multiple projects that are tightly coupled. When you make an adjustment to one project, you commit the changes and then 'checkout' that commit in other repositories that include it as a submodule. Keeps everything in sync yet not in the same repository – g19fanatic Mar 14 '17 at 11:24
  • You can have a tree of inter-dependent maven modules in a directory. That directory then maps to a git repository. – Thorbjørn Ravn Andersen Mar 14 '17 at 14:26
  • how would I set this up? – Alex Mar 14 '17 at 16:10

1 Answers1

0

I would advise you to always put all Eclipse configuration files to the repository when creating projects. What you should do is add all necessary maven integration related files to the repository (.project, .classpath, .settings/*m2e.core.prefs or better yet entire .settings). If you have done so, you are fine. If not, add them and pull changes on your colleague's machine.

On target machine remove the project from workspace, but do not delete contents. In Eclipse Git repositories view select your repository and expand to see Working tree. Right click it and select Import projects. This will trigger the flow you pointed our at Eclipse wiki. From there it should be straightforward - Eclipse will try to detect projects and will import them, so that they have Maven nature and are managed by EGit.

If you don't want to or cannot share maven configuration in the repository, have a look at this answer which tries to describe how to achieve that without Eclipse configuration files.

Community
  • 1
  • 1
Michał Grzejszczak
  • 2,599
  • 1
  • 23
  • 28
  • For Maven projects it is a _very, very_ bad idea to store IDE configuration files with the sources. The IDE should generate them exclusively from the pom.xml files! Also earlier I have seen that Eclipse does not work well with using configuration files from another version or with different plugins. – Thorbjørn Ravn Andersen Mar 14 '17 at 14:29