Which gradle task is present by default in any gradle project? I need to execute a custom task with every gradle build so I want to put dependsOn on that default task.
You can answer this question yourself by creating an empty build.gradle and running
gradle tasks
You won't find any tasks that actually do much, you'll see "setup" tasks (init & wrapper) and "help" tasks like model, help, dependencies, tasks etc but you won't find any "lifecycle tasks" such as build, check, assemble etc.
I'm guessing your actual question is "where do the lifecycle tasks such as build, check, assemble etc come from?" These lifecycle tasks are added by the Base plugin. The base plugin is applied by the java plugin and many others. If you want these lifecycle tasks in your custom build scripts and plugins you can
apply plugin: 'base'
task foo {
doLast { println 'foo' }
}
build.dependsOn foo
Note: Gradle is smart enough to apply any plugin only once. So many plugins in a single project can apply the base plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With