Yep...

task hello << {
        print "Hello"
}

task world << {
        print "World!"
}

world.doFirst {
        tasks.hello.execute()
        print " "
}


Hope that helps.

Thanks,
James


On Mon, Apr 25, 2011 at 5:35 PM, James Carr <[email protected]> wrote:
> I'll have to check, but off the top of my head I think you can do
> tasks[taskName].execute()
>
> Thanks,
> James
>
> On Mon, Apr 25, 2011 at 5:09 PM, Ali, Haneef <[email protected]> wrote:
>> If the test fails , then test.doLast is never called. Assuming doLast is 
>> called, still I don't understand how to call another task from doLast or 
>> from anywhere else.
>>
>>
>> Also if a task has both config closure and action closure, how will you 
>> define and call it
>>
>>
>> Thanks,
>> Haneef
>>
>>
>>
>> -----Original Message-----
>> From: Ken Sipe [mailto:[email protected]]
>> Sent: Monday, April 25, 2011 12:00 PM
>> To: [email protected]
>> Subject: Re: [gradle-user] How to call a task from another task
>>
>> why wouldn't you do a test.doLast() ?
>>
>> Ken Sipe | [email protected] | blog: http://kensipe.blogspot.com
>>
>>
>>
>> On Apr 25, 2011, at 12:58 PM, Ali, Haneef wrote:
>>
>>> Hi ,
>>>
>>> I have a tar task  which creates a tar of junit report which will be 
>>> published in another location.  All I want to do is,  call this task in 
>>> test   irrespective of test failure or success. I tried task.execute() and 
>>> it doesn't seem to work. Am I missing something
>>>
>>>
>>>
>>> task reportsTar(type: Tar ) {
>>>       // from, to  configuration
>>> }
>>>
>>>
>>> test {
>>>    afterSuite{
>>>       if (!it.parent){
>>>               reportsTar.execute()
>>>       }
>>>    }
>>> }
>>>
>>>
>>> Thanks,
>>> Haneef
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>

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

    http://xircles.codehaus.org/manage_email


Reply via email to