How to open Gradle Multi Module project in Intellij?
Hi,
I have IntelliJ Ultimate edition and I have a Gradle multi-module project where Gradle 2.14 is through the gradlew file in the multi-module projects root directory.
With Eclipse I'd do:
File -> Import > Gradle STS project -> Choose project root where multi-module folders reside -> click Build Model -> choose the modules I want to see in the IDE.
Projects are very big so I don't want to import all of them, I want to choose specific modules I want to work with.
Also to deploy in Eclipse I'd add Tomcat as a server and I'd move a specific project (resource) into Tomcat to run in there and it just works.
With IntelliJ?
File -> New -> Project from Existing Sources -> Choose multi-module root OR Choose a specific module I want to work with?
If I choose multi-module root
I get Java Heap exception as there are lots of modules and IntelliJ is trying to import all of them.
If I choose the module I want to work on:
Then I still get all the projects, it was very slow but I unloaded the ones I didn't need and couldn't figure out how to deploy it to Tomcat (by creating it as an artifact too, couldn't get it working?)
Also IntelliJ is very slow and unresponsive, constantly eating up CPU, interestingly I don't have these problems with Eclipse.
Any ideas?
Thank you,
Ata
Please sign in to leave a comment.
If I choose multi-module root
I get Java Heap exception as there are lots of modules and IntelliJ is trying to import all of them.
Try giving more memory to IDE (Help | Edito Custom VM Options action) and Gradle (Gradle VM options: field in import dialog), e.g. set -Xmx3g.
I unloaded the ones I didn't need and couldn't figure out how to deploy it to Tomcat (by creating it as an artifact too, couldn't get it working?)
Do you mean to deploy artifacts, produced by unloaded modules? If you unload the module - it is excluded from project build, so it would not be possible to create an artifact from it.
Hi Andrey, thank you for your answer.
Just to be sure, so the right way to import a multi module gradle project is importing the root folder and not importing a specific module's project directly 1 level under the root?
Thank you,
Ata
Yes, you should select the main build.gradle file.
Though if you do not need all the projects (and they are not direct sub-module of the root) you can import the projects by one in Gradle projects tool window.
I think the second thing you mention, not direct sub-modules applies to me because for example I have a `myProject-postgres` module under root and that's the one I deploy to tomcat to run, not the main project, I have `myProject-mssql` too which is deployed in tomcat for running with mssql database...