Task running first even with dependsOn

I have a deploy task, that I want to have copy my war to a webapp directory, for some reason It seems to be running first. Any ideas would be appreciated, thanks in advance.


Copy happening


      apply plugin: 'groovy'
    apply plugin: 'java'
    apply plugin: 'maven'
    apply plugin: 'idea'
    apply plugin: 'eclipse'
    apply plugin: 'eclipse-wtp'
      configurations {
        testCompile.extendsFrom provided
      //provided means we want to build with, but not runwith the dependency
    sourceSets.main.compileClasspath += configurations.provided
      repositories {
      compile project(':core')
    compile project(':wizard')
  apply plugin: 'war'
    webAppDirName = '../../../modules/core/src/main/webapp'
war.baseName = "hpi"
    sourceCompatibility = 1.6
      war {
    //copy project specific stuff inot the war
    println 'warrrrring'
    from '../../../modules/wizard/war'
    from 'war'
  task deploy (dependsOn: war){
    copy {
 println 'Copy happening'
        from war.archivePath
        into project.ext.get('TOMCAT_HOME') + '/webapps'

Hello Maxwell, you’re mixing up the configuration phase and execution phase of gradle. Your println statements are executed during the configuration phase of gradle and not during the task execution phase. For a better understanding of gradles build lifecycle, have a look at the explanation on a similar post here in the forum at http://forums.gradle.org/gradle/topics/custom_test_task_problem_all_run_all_the_time

and/or check the build lifecycle chapter in the gradle userguide at http://gradle.org/docs/current/userguide/userguide_single.html#build_lifecycle

cheers, René