Run/Debug Configuration: Gradle
Required plugin: Gradle (downloaded and enabled by default)
Run | Edit Configurations | | Gradle
tip
For more information, see Setting up a Gradle configuration.
You can run Gradle tasks using run configuration. The default options listed in such configuration are enough to run your task. If you want, you can also create an advanced configuration using additional options or adding more tasks and arguments.
Create a run/debug Gradle configuration
From the main menu, select Add Configuration. Alternatively, right-click any task in the Gradle tool window and select Modify Run Configuration.
Specify a name of your configuration in the Name field to quickly identify it when editing or running the configuration, for example, from the Run popup Alt+Shift+F10 or the Gradle tool window.
If you need, specify Store as project file that saves the file with the run configuration settings so you can share it with other team members. The default location is .idea/runConfigurations. However, if you do not want to share the .idea directory, you can save the configuration to any other directory within the project.
To change the location, select this option and click
and in the dialog that opens, add the new location.
If you don't need to specify anything in the Run field, the default tasks such as
help
and tasks specified in the Before build section. section will be executed. Alternatively, if you are creating a run configuration from the Gradle tool window, the task you have selected will be displayed in this field. However, you can specify additional external tasks and arguments for your run configuration. Use spaces to separate one task from another. If you want to see the available list of Gradle tasks and arguments, clickin the field.
Specify a location of your Gradle project.
You can either enter it manually or click
and point to the desired location in the dialog that opens. However, if you are creating a run configuration from the Gradle tool window, CLion will display the name of your project automatically.
You can also click Gradle registered projects
icon to select an available Gradle module from the list of registered Gradle modules in your existing CLion project.
If you need, you can specify a path to the build script file instead of the project path. This might be helpful if you have a custom build script to which you want to refer.
If you need, specify the environment variables that you want to use in you project.
The following default options are enabled, but you can click Modify options to add new options or remove some of the default ones in Add Run Options:
Open run/debug tool window when started- automatically opens the Run/Debug tool window when the configuration is executed and several debugger options
Debug forked tasks in the same session- makes the debug process to run under one tab. Remove (
) this option if you want to see each debugging process in a separate tab.
Enable Gradle script debugging- enables breakpoints in the Gradle scripts.