<project>
<target name="run">
<script language="groovy">
println "Hello world!"
</script>
</target>
</project>
It won't work. You'll get "Unable to create javax script engine for groovy". <target name="run">
<script language="groovy">
println "Hello world!"
</script>
</target>
</project>
So then you read further about library dependencies, but no real example of how to get it to work. This is the lack I'm writing about. No examples. You have to include the groovy library jars or the single embeddable, groovy-all-x.x.x.jar. So, to run the above script you would do something like:
ant -lib \java\GroovyVersions\Groovy-1.8.6\embeddable\groovy-all-1.8.6.jar run
Buildfile: C:\temp\build.xml
run:
[script] Hello world!
BUILD SUCCESSFUL
Total time: 0 seconds
Or modify the classpath, or use Ant's lib extension capability. Of course, why would you use the 'script' task when the 'groovy' task is available? You wouldn't.
Further Reading
Ant script task
Groovy Ant task
No comments:
Post a Comment