I assume that you missed the fact that you did not define tasks here, but configured tasks. Take a look at the gradle documentation: http://www.gradle.org/docs/current/userguide/more_about_tasks.html .
What you wanted is something like this:
task runsSQL (dependsOn: 'runSchema'){ description 'run sql queries' println 'Configuring SQL-Task' doLast() { println "Executing SQL" } } task runSchema << { println 'Creating schema' }
Note the shortcut '<<for' doLast '. The doLast step is performed only when the task is completed, when the configuration of the task is completed during the analysis of the gradle file.
When you call
gradle runSchema
You will see "Configure SQL Task" and then the output "Create Schema". This means that runSQLTask will be configured, but will not be executed.
If you call
gradle runSQL
What you will see:
Setting up an SQL task: runSchema Creating a schema: runsSQL Executing SQL
runSchema runs because runSQL depends on it.
Tobish
source share