Running Groovy script from Gradle

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Running Groovy script from Gradle

strayph
Now that I have put my script under src/main/groovy, and it compiles, how can I actually run it from gradle?

Is there an example task for this?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Running Groovy script from Gradle

Levi Hoogenberg

An Exec task would work, I guess, as long as the Groovy runtime blades are available.

Op 5 mei 2011 19:51 schreef "strayph" <[hidden email]> het volgende:
> Now that I have put my script under src/main/groovy, and it compiles, how can
> I actually run it from gradle?
>
> Is there an example task for this?
>
> Thanks
>
> --
> View this message in context: http://gradle.1045684.n5.nabble.com/Running-Groovy-script-from-Gradle-tp4373467p4373467.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 | Threaded
Open this post in threaded view
|

Re: Running Groovy script from Gradle

Levi Hoogenberg

Stupid dictionary... *classes*, not blades, of course.

Op 5 mei 2011 20:06 schreef "Levi Hoogenberg" <[hidden email]> het volgende:
> An Exec task would work, I guess, as long as the Groovy runtime blades are
> available.
> Op 5 mei 2011 19:51 schreef "strayph" <[hidden email]> het volgende:
>> Now that I have put my script under src/main/groovy, and it compiles, how
> can
>> I actually run it from gradle?
>>
>> Is there an example task for this?
>>
>> Thanks
>>
>> --
>> View this message in context:
> http://gradle.1045684.n5.nabble.com/Running-Groovy-script-from-Gradle-tp4373467p4373467.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 | Threaded
Open this post in threaded view
|

Re: Running Groovy script from Gradle

Philippe Lhoste
On 05/05/2011 20:07, Levi Hoogenberg wrote:
> Stupid dictionary... *classes*, not blades, of course.

I thought it was a quite poetic way of expression, bringing a mental image of blades
hacking and slashing the source code to make a pulp of bytecode... :-)
(even if you were not referring to the compiler, mental images don't reason...)

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --


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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Running Groovy script from Gradle

Benjamin Muschko
In reply to this post by strayph
One way to run your script is to use GroovyShell. If you want to pass in variables GroovyScriptEngine would be a good option. Here's an example for using GroovyShell:

task runScript << {
    new GroovyShell().run(file('src/main/groovy/yourscript.groovy'))
}