There are so many small tasks that as solved via a tiny programs. Most of such programs are to call several libraries to have an end-result. In the JVM world, most of those libraries are downloadable from a maven repository.
It could be tricky in general to deliver dependencies for the script to run. There are several possible ways to solve it.
I found an easy way to make Gradle download dependencies and run a script. This makes the scripting done with groovy too.
Here goes an example to run an Amazon API and wrap it as Gradle task:
The only trick here is that Gradle includes all script dependencies into classpath where tasks are loaded and executed.
Even more, adding Gradle Wrapper
makes it runnable on eveny machine with JVM only.
(A Wrapper
task can be used to have Gradle generate wrapper scripts)
Happy scripting!
comments powered by Disqus