Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing multiple git repositories into one project in Intellij

I'm moving over from eclipse to Intellij, and I hit a snag on setting up my project

I have 4 projects on github that, in eclipse, all live in one workspace. They are API, Server, Client, and Basic Plugin, and they each have a Maven pom.

What I want to do is set up Intellij's project structure similar to Eclipse's workspace, where all 4 of those projects are side by side in the explorer, but it's not letting me import more than one maven project as a module (I import the first fine, but the rest silently fail), and importing directly from github creates a whole new project for each repository, which is not ideal.

I tried to import a in my eclipse workspace, but it all broke (Object and Math were not found), and all the java environment setting were wrong.

Any ideas? I'm fairly new with Intellij and I really like it, but I don't want to switch over from eclipse if I can't get my workflow right.

like image 923
RoyAwesome Avatar asked Feb 01 '12 06:02

RoyAwesome


People also ask

How do I import multiple modules in IntelliJ?

From the main menu, select File | New | Module from Existing Sources. In the dialog that opens, specify the path the . iml file of the module that you want to import, and click Open. By doing so, you are attaching another module to the project without physically moving any files.


1 Answers

First of all, Intellij IDEA uses different naming than Eclipse, you can learn the details here: http://www.jetbrains.com/idea/documentation/migration_faq.html. In short, Eclipse's Workspace is called Project in IDEA, and Eclipse's Project is Module in IDEA. In your case, you want to have multiple Maven-based modules in one Project. You can do it by creating a Project with one Module and then adding the rest of Modules (File->Add Module->Import Module from external model->Maven etc.).

As for the multiple Git repositories, you can configure that using this help page: http://www.jetbrains.com/idea/webhelp/git-branches-in-multirooted-projects.html

In your case, have a look at the 'Asynchronous branch control' section). It's really straightforward, I have just done it myself for the first time by following these instructions.

Good luck.

UPDATE: The above link now gives 404, so here are the most up-to-date ones that may be of help:

  1. https://www.jetbrains.com/help/idea/2017.1/git-branches-in-multirooted-projects.html
  2. https://www.jetbrains.com/help/idea/using-git-integration.html
like image 135
piotr.d Avatar answered Oct 02 '22 21:10

piotr.d