Gangmax Blog

The Best Way to Import Gradle Project into IntelliJ IDEA

From here.

When opening a Gradle project with “idea” plugin configuration in it, you can use the following commands to “generate/clear” the IDEA project files needed by IntelliJ IDEA IDE:

1
2
3
4
5
6
7
8
# Generates all IDEA configuration files.
gradle idea

# Generates all IDEA configuration files and opens the project in IDEA.
gradle openIdea

# Removes all IDEA configuration files
gradle cleanIdea

After running the “idea” or “openIdea” command, everything is set when this project is opened in IntelliJ IDEA IDE. This is a feature I want for a long time. Before this feature, opening the Gradle project directly in IntelliJ IDEA was vever fully successful in my experience. All all kinds of problems happened: source directory was not recognized, sub-projects were not parsed and etc.

A good thing is, if you don’t want the IDEA configuration files anymore, you can just run the “gradle cleanIdea” command to clean them. Cool.

Comments