Configure which gradle tasks are called when build button is pushed
Answered
I haven't been able to find an answer anywhere, but is it possible to somehow change the behaviour of which gradle tasks are called when the build button is pushed?
Currently it seems to be calling a couple of different gradle tasks on all modules which unfortunately does not work with our project, so I would like to control which tasks are called.
Please sign in to leave a comment.
When building IDE will always execute "classes" and "testClasses", please see the documentation https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_tasks The same would work if you build project by Gradle from the command line. If you want to customize Gradle build you can configure tasks dependencies in Gradle build script.
Hi Andrey
Thank you for your reply
The issue is that our project consists of three modules with module 1 depending on module 2 and module 2 depending on module 3 and they are all build cascading by only running classes in the top most module.
When I use the build button, IntelliJ will execute classes and testClasses for all modules, which means that there will be clashes between the different modules trying to build on top of each other.
Unfortunately I cannot currently change the way things are setup, so I am just trying to get everything to work with what I currently have.
You can select the required module and calling Build | Build <module name> action.
You can also use Gradle means of configuring projects build order, e.g. check the https://stackoverflow.com/a/42349993/2000323 https://docs.gradle.org/current/userguide/intro_multi_project_builds.html#sec:multiproject_build_and_test
Otherwise, you can set to IntelliJ IDEA the Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Build and run using option and use IDE to build each module individually by selecting it and execute Build | Build <module name> action.