Following your example you should be able to do something like

    GreetingTask {
      greeting = System.properties['GreetingTask.greeting'] ?: 'roman' 
    }

which will produce the desired result, no?
  Cos

On Sun, Jan 04, 2015 at 05:57PM, Roman Shaposhnik wrote:
> On Sun, Jan 4, 2015 at 7:46 AM, jay vyas <[email protected]> wrote:
> > possibly a similar issue which I dealt with: I just added argument and user
> > guidance stuff  into settings.gradle,
> > https://github.com/apache/bigtop/blob/master/bigtop-tests/smoke-tests/settings.gradle
> 
> I think this is a fine approach, but I was looking for something more
> generic. Consider
> this: if I defined a custom task along the following lines:
> 
> class GreetingTask extends DefaultTask {
>     String greeting = 'hello from GreetingTask'
> 
>     @TaskAction
>     def greet() {
>         println greeting
>     }
> }
> 
> I can then utilize it in my build.gradle as follows:
> 
>    GreetingTask {
>         greeting = 'roman'
>     }
> 
> I wish there was a generic way of doing and equivalent
> from the command line a'la:
> 
> $ gradle GreetingTask -DGreetingTask.greeting=roman
> 
> 
> Thanks,
> Roman.

Attachment: signature.asc
Description: Digital signature

Reply via email to