I am fairly new to gradle so this might be a silly question. 

I have the following code:

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

task someOtherTask << {
        println 'Foo..'
}

void assertPropertySet(String propertyName) {
        if( !rootProject.hasProperty(propertyName) )
                throw new RuntimeException('\''+propertyName+'\' not set. 
Please set it
like this -> -P'+ propertyName+'=')
}

I want to make sure some properties are set in order to perform a task. But
even if I call another task, say 'someOtherTask', that does not require the
properties to be set, I get my RuntimeException saying that I need to set
some properties. In other words assertPropertySet method is still called. I
only want to call assertPropertiesSet when I call revertServerVMImage task. 

Am I misunderstanding something?

Thanks for your support!


--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Configuration-phase-executing-methods-tp4258894p4258894.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