I would like to be able to run ruby and perl scripts from build.xml in ant.
+1
A:
You can always use the ant`s exec task to run arbitrary programs, such as ruby and perl. For example and from the docs:
<target name="help">
<exec executable="cmd">
<arg value="/c"/>
<arg value="ant.bat"/>
<arg value="-p"/>
</exec>
</target>
Kaleb Pederson
2010-08-20 21:29:02
+3
A:
Languages like Ruby have Java implementations.
<project name="RunRubyExample">
<property environment="env" />
<script language="ruby" manager="bsf">
<classpath>
<fileset dir="${env.JRUBY_HOME}/lib" includes="*.jar" />
</classpath>
print 'hello world'
</script>
</project>
See the list of languages supporting the JSR233 standard.
Unfortunately no Java version of Perl is available. The only way to run Perl scripts is to invoke the interpreter directly:
<project name="RunPerlExample">
<exec executable="perl" failonerror="true">
<arg value="-e" />
<arg value="print 'hello world'" />
</exec>
</project>
Mark O'Connor
2010-08-20 21:47:47
I was completely unaware of `<script>`. Thanks for the great heads up!
Kaleb Pederson
2010-08-20 22:21:46