如何在per中运行perl和ruby脚本作为任务?

kam*_*mal 3 ruby ant perl

我希望能够从ant中的build.xml运行ruby和perl脚本.

Mar*_*nor 6

像Ruby这样的语言有Java实现.

<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>
Run Code Online (Sandbox Code Playgroud)

请参阅支持JSR233标准的语言列表.

不幸的是,没有Java版本的Perl可用.运行Perl脚本的唯一方法是直接调用解释器:

<project name="RunPerlExample">
    <exec executable="perl" failonerror="true">
        <arg value="-e" />
        <arg value="print 'hello world'" />
    </exec>
</project>
Run Code Online (Sandbox Code Playgroud)