IntelliJ IDEA 2019.3 Help

Gradle settings

Settings / Preferences | Build, Execution, Deployment | Build Tools | Gradle

Use this page to configure settings for Gradle projects that were created, opened, or linked.

Item

Description

Gradle user home

Use this field to specify the location of stored Gradle caches, downloaded files, and so on.

If Gradle location has been defined by the environment variables GRADLE_HOME or PATH, then IntelliJ IDEA deduces this location, and suggests this path as the default value.

If the Gradle location has not been deduced from the environment variables, specify it manually, or click the Browse button, and select the desired directory in the dialog that opens. Note that the value entered in this field takes preference over the environment variables.

Generate *.iml files for modules imported from Gradle

Select this option to store the generated .iml and library files in the .idea directory instead of idea.system.path.

It might be helpful in the following cases:

  • sharing the IDE-specific module settings via VCS since the .idea directory stores project-level settings. You can also opt for the gradle-idea-ext plugin that helps you describe the project settings in the build.gradle file.

  • correctly opening a project that contains both regular IntelliJ IDEA modules and Gradle modules.

  • accessing a project faster when you open it since IntelliJ IDEA reads the .iml files first and then starts the importing process.

Gradle projects

You can have several linked Gradle projects when you work in IntelliJ IDEA. You can configure settings for each selected project.

Automatically import this project on changes in build script files

If you select this checkbox, IntelliJ IDEA automatically re-imports your project every time you make changes in the build script files. In large projects, selecting this option might slow down the editing of your build script.

When you uncheck this option, you need to manually re-import the project every time you change build script files. In this case, you can control the re-importing of the project.

Build and run

Use this section to specify what IntelliJ IDEA should use when you run tests, build, or run tasks in the selected linked project.

Build and run using

Use this list to select how you want to build and run your project. Use Gradle as a default option or select IntelliJ IDEA.

If you have a pure Java or a Kotlin project, it is sometimes better to select IntelliJ IDEA for building a project. IntelliJ IDEA supports the incremental build which significantly speeds up the building process. Yet, keep in mind that the IntelliJ IDEA compiler does not support some parts of the Gradle project build processing and might cause problems in building your project correctly.

Run tests using

Use this list to select how you want to run tests in your project. Use Gradle as a default option or select IntelliJ IDEA.

Gradle

Use Gradle from

Use this list to configure a Gradle version for your project.

You can select one of the following options:

  • 'gradle-wrapper.properties' file: this is a recommended default option that uses Gradle wrapper.

    In this case you delegate the update of Gradle versions to Gradle and get an automatic Gradle download for the build. This option also lets you build with a precise Gradle version. The Gradle version is saved in the gradle-wrapper.properties file in the gradle directory of your project and helps you eliminate any Gradle version problems.

  • 'wrapper' task in Gradle build script: select this option to configure a Gradle wrapper according to the wrapper task configuration. It might be convenient if you prefer to control which Gradle version to use in the project.

    If you used the default Gradle wrapper option and then switched to the Gradle wrapper task configuration, changes you made in the task automatically update during the project import.

  • Specified location: select this option if you don't want to use the Gradle wrapper and prefer to manually download and use a specific Gradle version instead. Specify the location of your Gradle installation.

Gradle JVM

Use this field to specify the JVM under which IntelliJ IDEA will run Gradle when you import the specified Gradle project and when you execute its tasks. The default is set to your project JDK.

This field overrides any other Gradle JVM selection. You can check a process of how IntelliJ IDEA selects the Gradle JVM version in the Gradle JVM selection section.

Last modified: 26 April 2020