bmuschko / gradle-cargo-plugin

Gradle plugin that provides deployment capabilities to local and remote containers via Cargo
Apache License 2.0
258 stars 63 forks source link

Lazy evalution of custom deploy #137

Closed mellson closed 8 years ago

mellson commented 8 years ago

Is it possible to create a custom deploy task that is lazily evaluated?

task deploy(type: CargoRedeployRemote) << {
    def hostInput = "$host"
    def passwordInput = "$pass"
    def projektInput = "$modul"

    def context = projektInput.toLowerCase()
    def modulNavn = context.capitalize()

    containerId = 'tomcat7x'
    hostname = hostInput
    username = 'tomcat'
    password = passwordInput
}

If I add the << I get these errors when I run my deploy task

> No value has been specified for property 'containerId'.
> No value has been specified for property 'username'.
> No value has been specified for property 'password'.

What I want to achieve is to either provide these arguments on the command line or create another task which asks the user for input.

bmuschko commented 8 years ago

You are assigning the property values during the execution phase which is too late to configure the task. You can provide these arguments as project or system properties on the command line and parse them from the build script. You won't need the <<.

mellson commented 8 years ago

Thank you for the answer, much appreciated!