Skip to content Skip to sidebar Skip to footer

Why Gradle Clean Task Starts All Other Non-default Tasks?

I have gradle set up and running. My build.gradle has 2 tasks defined inside: task setVersion() { println('setVersion') //... } task setIntegrationEnv() { println('set

Solution 1:

Could You please provide full build.gradle script? I'd be much easier to help You. You've probably mistaken gradle build phase with configuration phase - it's a common topic here.

General rule is that code You'd like to be run at build phase should be added as an action:

task someTask << {
   println'runtime'
}

while code You'd like to run at configuration phase should be added in task body:

task someTask  {
   println 'configuration
}

or all together:

task someTask {
   println'configuration'

   doLast {
      println'runtime'
   }
}

Additional info can be found here, here and here.

Post a Comment for "Why Gradle Clean Task Starts All Other Non-default Tasks?"