Gradle configures all tasks, even ones that eventually don't get executed.
One way to solve your problem is to wrap the asserts with doFirst {}:

task revertServerVMImage( type: Exec ) { 
    doFirst {
        assertPropertySet('remoteHostname') 
        assertPropertySet('shortname') 
    }
        
    commandLine = ... 
} 

One drawback of this approach is that it may cause the build to fail at a
time where other tasks have already been executed.

--
Peter Niederwieser 
Developer, Gradle
http://www.gradle.org
Trainer & Consultant, Gradleware
http://www.gradleware.com
Creator, Spock Framework
http://spockframework.org


--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Configuration-phase-executing-methods-tp4258894p4258997.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to