12

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

ever alian
  • 1,028
  • 3
  • 15
  • 45
  • 1
    check this link it may be helpful: http://stackoverflow.com/questions/17941725/intellij-idea-with-multiple-gradle-subprojects – soorapadman Sep 18 '15 at 04:07
  • How are you importing them? – Makoto Sep 18 '15 at 04:24
  • @Makoto I tried `File > Import Module` and then selected the `build.gradle` file. and `Next`. Also I tried `Select File->Project Structure->Modules`. then clicked on the `plus sign` and tried to add the module. – ever alian Sep 18 '15 at 06:30
  • @Soorapadman This one didn't help me. I alrady have the said properties in the `build.gradle` – ever alian Sep 18 '15 at 06:33
  • You would be much better upgrading to latest Intellij as it has LOTS of gradle goodness – Santosh Gokak Sep 18 '15 at 20:54
  • @SantoshGokak I am using licence version under my company. Can I upgrade it for free under same licence? – ever alian Sep 21 '15 at 02:36
  • I don't think free version has any limitation for commercial use. check http://stackoverflow.com/questions/1583995/am-i-missing-something-about-the-intellij-announcement/1584020#1584020 – Santosh Gokak Sep 21 '15 at 21:41

4 Answers4

17

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

Doron Gold
  • 3,664
  • 4
  • 32
  • 44
3

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

RubenLaguna
  • 21,435
  • 13
  • 113
  • 151
0

IDEA supports having multiple projects open simultaneously (see here).

I think the issue is with how you are trying to open it. Try just opening the other build.gradle file with File > New > Project.. and IDEA should import as a new project and give you the option to open in a new window.

Disclaimer: I haven't actually tried this in the version of intellij you are using (it's possible the gradle integration isn't quite the same as the latest version for this (14.1 as of this writing).

leeor
  • 17,041
  • 6
  • 34
  • 60
  • the link you gave itself says `Click This Window button to close the current project and opening the new one in the same window.` Also in `IntelliJ` the project is similar to `Workspace` and `module` is similar to `projects` in `Eclipse`. – ever alian Sep 18 '15 at 09:51
  • 2
    I think the author wants to open both projects on the same window, which cannot be done by open new projects. The solution proposed by @doron-gold works fine – gortiz Aug 09 '17 at 15:11
-1

It is not possible in IDEA up to 2016.1.2

Andrii Rubtsov
  • 524
  • 3
  • 13