Which Gradle tasks are run by the "Build Project" action? Is there any way to configure this?
Answered
I have a Gradle project imported into IntelliJ, and IntelliJ is configured to build and run using Gradle for this project. "Build Projects" currently runs the 'classes' and 'testClasses' task for most of the modules/sub-projects. However, for the remaining ones, it runs the 'assemble' task. I'm curious how IntelliJ determines what task(s) to run for a given module when "Build Projects" is invoked.
I'm also curious if it's possible to configure IntelliJ to run a different task: we have some expensive operations tied to 'assemble' that I'd like to avoid running in typical IDE builds.
Please sign in to leave a comment.
>"Build Projects" currently runs the 'classes' and 'testClasses' task for most of the modules/sub-projects. However, for the remaining ones, it runs the 'assemble' task. I'm curious how IntelliJ determines what task(s) to run for a given module when "Build Projects" is invoked.
When the build is delegated to Gradle, IDE uses Gradle's
*classestasks to compile sources and if there are no such tasks (e.g. if thejavaplugin was not applied to the Gradle project) the build should be delegated toassembletask if it was defined for the project.>I'm also curious if it's possible to configure IntelliJ to run a different task: we have some expensive operations tied to 'assemble' that I'd like to avoid running in typical IDE builds.
It is possible to bind a task to different actions in IDE, using triggers for Gradle tasks, but there is no such an ability to change the tasks which are called by the IDE for the Gradle delegated build.
Thanks, Andrey. That makes sense. After applying the java plugin to those modules, IntelliJ runs only the classes and testClasses tasks. The tasks are no-ops since these are not java modules, but I'm ok with it and it doesn't seem to be causing any issues.