我正在尝试使用使用 exec 的 Ant 任务进行构建。这是我的任务的一个片段:
<exec executable="cmd" failonerror="true" osfamily="windows">
<arg value="/c" />
<arg value="${path.installer}" />
<arg value="-silent"/>
<arg value="-allowDownload"/>
<arg value="-eulaAccepted"/>
</exec>
这本质上是一个安装程序。当我尝试从路径运行安装程序 (.exe) 时,我收到以下错误:C:\Users\abc\jenkins\install.xml:57: exec 返回:7(第 57 行指向 exec 的开头)
我使用详细选项运行 ant 以获取更多详细信息:
[antcall] Exiting C:\Users\abc\jenkins\install.xml.
[echo] Installing new build from C:\Users\abc\jenkins\BA\integration_win\Nuze.exe
[exec] Current OS is Windows 7
[exec] Executing 'cmd' with arguments:
[exec] '/c'
[exec] 'C:\Users\abc\jenkins\BA\integration_win\Nuze.exe
[exec] '-silent'
[exec] '-allowDownload'
[exec] '-eulaAccepted'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
target 'install.nuze' failed with message 'exec returned: 7'.
BUILD FAILED
C:\Users\abc\jenkins\install.xml57: exec returned: 7
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:646)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExeutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
此外,我可以确认我的 Jenkins 从站可以访问 C:\Users\abc\jenkins\BA\integration_win\Nuze.exe,我可以从该位置手动安装而不会出现任何问题。知道我在哪里出错了吗?我查找了错误代码,但通常我得到的提示是 ant 配置可能存在一些问题。任何指针?非常感谢您的帮助。