我正在尝试使用一个使用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 returned: 7 (line 57 points to beginning of 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配置问题。有什么指针吗?非常感谢您提前的帮助。