3
我希望能夠從ant中的build.xml運行ruby和perl腳本。如何在ant中運行perl和ruby腳本作爲任務?
我希望能夠從ant中的build.xml運行ruby和perl腳本。如何在ant中運行perl和ruby腳本作爲任務?
您可以隨時使用ant的exec任務來運行任意程序,例如ruby和perl。例如,從文檔:
<target name="help">
<exec executable="cmd">
<arg value="/c"/>
<arg value="ant.bat"/>
<arg value="-p"/>
</exec>
</target>
像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>
請參閱list of languages supporting the JSR233 standard。
不幸的是沒有Java版本的Perl可用。運行Perl腳本的唯一方法是直接調用解釋器:
<project name="RunPerlExample">
<exec executable="perl" failonerror="true">
<arg value="-e" />
<arg value="print 'hello world'" />
</exec>
</project>
我完全不知道'
您到目前爲止嘗試過了什麼?你有關於Ant文檔的具體問題嗎? – Ether 2010-08-20 21:26:12