How can run tasks periodicly in gradle?

I am trying to schedule tasks to run periodicly in gradle, in order to set a refresh rate of deployment similar to what maven has with jetty that redeploy your app if necesary.

It is annoying to keep running jettyRun everytime I do some small change.

Thanks.

PD. this is crossposting http://stackoverflow.com/questions/13131073/gradle-run-tasks-periodicly

Hey Jose,

I don’t quite understand your use case. If you describe it better, and explain why you need to ‘keep running jettyRun’ we might be able to help you. Your stackoverflow question could be improved, too, to increase the chance other members help out.

Cheers!

Something similar to what the JettyRun documentation said

"Once started, the web container can be configured to run continuously, scanning for changes in the project and automatically performing a hot redeploy when necessary. "

http://www.gradle.org/docs/current/dsl/org.gradle.api.plugins.jetty.JettyRun.html

But it doesn’t said how. In maven is basicly

<configuration>
                      <scanIntervalSeconds>0</scanIntervalSeconds>
                      <daemon>true</daemon>
</configuration>

Oh, it appears it’s not documented in the dsl reference. I’ll fix that, in meantime take a look at this property: http://www.gradle.org/docs/current/javadoc/org/gradle/api/plugins/jetty/AbstractJettyRunTask.html#setScanIntervalSeconds(int)

You need something like that:

myJettyRun {
   scanIntervalSeconds = 1
}

When interval <= 0 it is not used at all.

Hope that helps!