Reputation: 33
I am trying to build using an Ant task that uses exec. Here is a snippet of my task:
<exec executable="cmd" failonerror="true" osfamily="windows">
<arg value="/c" />
<arg value="${path.installer}" />
<arg value="-silent"/>
<arg value="-allowDownload"/>
<arg value="-eulaAccepted"/>
</exec>
This is essentially an installer. When I am trying to run the installer (.exe) from the path, I am getting the following error: C:\Users\abc\jenkins\install.xml:57: exec returned: 7 (line 57 points to beginning of exec)
I ran ant with verbose option to get more details:
[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)
Also I can confirm that my Jenkins slave has access to C:\Users\abc\jenkins\BA\integration_win\Nuze.exe and I can install manually from that location without any issues. Any idea on where I am erring? I looked up error codes, but generally the tip I got is that there could be some issue with ant configuration. Any pointers? Thanks a ton in advance for the help.
Upvotes: 3
Views: 3042
Reputation: 77971
Doesn't look like a ANT issue. "7" is the return code of the program you're running. You need to consult the documentation of the "nuze" program you are running.
Non-zero error codes indicate to ANT that the program has failed and programmers often return different codes to indicate to the calling program what went wrong. Standard OS stuff.
Upvotes: 1
Reputation: 11440
I am not very knowledgeable on this subject but sense there are no other answers I figured I would give it a shot. From looking at similar problems maybe try re-phrasing your xml
<exec executable="cmd" failonerror="true" osfamily="windows">
<arg line="/c ${path.installer} -silent -allowDownload -eulaAccepted"/>
</exec>
Upvotes: 0