Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open Multiple Gradle projects in same IntelliJ instance? [duplicate]

I am strugglling to open multiple Gradle projects in same IntelliJ instance without luck.

I tried to open second project as a module by importing it but still it's asking me to open in the same window and in a new window. So If I give same window, it replace the project that already in.

Any one can advice?

My IntelliJ version is IntelliJ IDEA 12.1.4

like image 926
ever alian Avatar asked Sep 18 '15 03:09

ever alian


2 Answers

In the IntelliJ window where you currently have a single Gradle Project open, do the following:

  1. Open the "Gradle Tool Window" panel, press "Attach Gradle Project" button on top of the panel (green Plus sign).
  2. Select "build.gradle" file of some other Gradle Project.
  3. Press OK.

You can repeat these steps for as many Gradle Projects as you like and have multiple Gradle Projects open in the same IntelliJ window.

In pictures:

Step 1:

step 1

Step 2:

step 2

Step 3:

step 3

Result:

result

like image 67
Doron Gold Avatar answered Oct 04 '22 14:10

Doron Gold


See https://stackoverflow.com/a/57791201/90580

Currently in IntelliJ IDEA 2019.2 you can add the gradle subprojects like so

  1. Open Gradle Tool Window via View > Tool Windows > Gradle menu
  2. Click on "Link Gradle Project" button (the plus sign)Link Gradle Project button
  3. Select the build.gradle file corresponding to the subproject
  4. Go to File > Project Structure > Modules > NameOfSubproject
  5. Navigate to main/java and click on Mark as: Sources enter image description here
  6. Mark the main/resources as Resources
  7. Restart IntelliJ IDEA

The sources of the subproject will be recognized by IntelliJ and you can use Navigate Class action for the classes in the subproject

like image 23
RubenLaguna Avatar answered Oct 04 '22 15:10

RubenLaguna