我如何使用Ant任务EXEC执行一个Perl脚本? [英] How can I execute a Perl script using the Ant exec task?
问题描述
我现在有这在我的Ant构建脚本:
I currently have this in my Ant build script:
<exec dir="${basedir}" executable="perl">
<arg line="${basedir}/version.pl -major"/>
</exec>
然而,在运行时,我得到这个错误信息:
However, when that runs, I get this error message:
[执行]无法打开-major
[执行]结果:2
[exec] Could not open -major
[exec] Result: 2
要我,说我有什么正试图运行名为-major文件,该文件不存在。该文件是version.pl所花-major参数。
To me, that says that what I have is trying to run a file called -major, which doesn't exist. The file is version.pl which takes an argument of -major.
我怎样才能改变这种与参数-major version.pl运行?
How can I alter this to run version.pl with the argument -major?
请注意,我在Solaris机器上运行Ant脚本,但是跨平台或其他操作系统的解决方案,欢迎给后人。
Note that I am running the ant script on a Solaris machine, however cross-platform or solutions for other OSes are welcome for posterity.
推荐答案
我做了一个小巧的Perl脚本,没有做了一大堆,并在Solaris盒使用Ant 1.5跑了就好传递命令行参数给它。
I made a quick little Perl script that didn't do a whole lot and ran it just fine passing command line arguments to it using Ant 1.5 on a Solaris box.
<project name="perly" basedir="." default="run">
<target name="run">
<exec executable="perl" dir="${basedir}">
<arg value="version.pl"/>
<arg value="-major"/>
</exec>
</target>
</project>
$ ant run
我不是很明白的是你是如何得到无法打开-major。这是一个自定义死亡
消息还是什么?是否有应该是过去了,而不是主要的文件名?
What I can't quite understand is how you are getting "Could not open -major". Is this a custom die
message or something? Is there supposed to be a filename passed instead of major?
这篇关于我如何使用Ant任务EXEC执行一个Perl脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!