Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从ant build将ruby脚本作为任务运行?_Ant - Fatal编程技术网

如何从ant build将ruby脚本作为任务运行?

如何从ant build将ruby脚本作为任务运行?,ant,Ant,我有一个现有的ant构建,它通过ant-lib-f test\u build.xml 我想再添加一个部分,以便在现有部分完成后运行。我做了一些研究,发现,甚至在这里。经过一些阅读,我添加了新的目标到这个现有的建设,但它没有工作 我试图仅使用我的目标创建新的生成文件。它也不起作用。尽管ant运行在消息buildsuccessful时结束 总时间:0秒 如果我从命令行运行ruby脚本,它就会工作。我试图创建一个bat文件来调用我的ruby脚本,结果也是一样的。如果我从dos窗口调用bat文件,它会工

我有一个现有的ant构建,它通过
ant-lib-f test\u build.xml

我想再添加一个
部分,以便在现有部分完成后运行。我做了一些研究,发现,甚至在这里。经过一些阅读,我添加了新的目标到这个现有的建设,但它没有工作

我试图仅使用我的目标创建新的生成文件。它也不起作用。尽管ant运行在消息
buildsuccessful时结束
总时间:0秒

如果我从命令行运行ruby脚本,它就会工作。我试图创建一个bat文件来调用我的ruby脚本,结果也是一样的。如果我从dos窗口调用bat文件,它会工作

我的ant运行构建文件如下所示

<project name="RunRubyExample">

<target name="calling ruby " >
  <exec executable="ruby.exe">
    <arg value="C:\EduTester\others\afterant.rb 1 2 tri four"/>
  </exec>
</target>

<target name="calling batach">
  <exec executable="cmd">
    <arg value="/c"/>
    <arg value="C:\EduTester\others\rubruby.bat 1 2 tri four"/>
  </exec>
</target>

</project>

  • ApacheAnt(TM)版本1.8.2于2010年12月20日编译
  • 在Windows XP上

看起来您传递的是一个带有嵌入空格的arg

<arg value="C:\EduTester\others\afterant.rb 1 2 tri four"/>

是这样吗?或者应该是arg

<arg line="C:\EduTester\others\afterant.rb 1 2 tri four"/>

或多个参数值:

<arg value="C:\EduTester\others\afterant.rb"/>
<arg value="1"/>
<arg value="2"/>
<arg value="tri"/>
<arg value="four"/>

需要指定需要运行的目标

  • 通过
  • 或者在调用ant构建文件时。在传递要作为参数运行的目标名称的位置<代码>ant-lib调用Ruby


谢谢@Steve

我尝试了
,并用空格将行分隔为多个参数行。没有一个奏效。我只有
构建成功
。有什么方法可以调试ant运行吗?“Radek-您可以尝试
ant-debug
,后面跟着其他参数。您还可以查看的FailOneError、errorproperty、outputproperty属性-可能能够在这些属性中捕获更多信息。debug和FailOneError没有提供任何新信息。我不知道如何使用其他的
errorproperty,outputproperty
。有没有办法找出ant是否运行exec中指定的内容?