What Gradle task is used to build when "Delegate IDE build/run actions to Gradle" is enabled?


What Gradle task is used to build when "Delegate IDE build/run actions to Gradle" is enabled?  Is it `build`?  `assemble`?  Something else?


If I have a composite build, does IntelliJ only directly run tasks on the composite?  Or does IntelliJ ever directly run tasks from included builds?

1 comment

It depends on the module (in particular depends on the available tasks of the related gradle project).

The general rules are as following:

  1. To build jvm module (i.e. to compile classes/resources) `*classes` tasks will be used.
    E.g.  for the main source set => `classes`
    for test sources set => `testClasses`
    for other custom source sets => `sourceSetName + "Classes"` // this is supported if the `Create separate IDE module per source set` option is enabled
  2. To build other modules `assemble` task will be used.
  3. To build web artifacts => `war` task, for entreprise artifacts => `ear` task

For composite builds, there is no possibility to run tasks of the included build using the `main` composite root build in Gradle.

However IDEA knows the available tasks and root path of the included builds and uses them directly.This should work for running Gradle task using the IDEA Gradle tool window and automatically when the build is delegated.

To repeat similar in terminal you have to `cd` into the folders of the included builds or use `--build-file`, `--project-dir` Gradle command line options.


Please sign in to leave a comment.