0
votes

I am using master/slave Jenkins. Now, i have a Jenkins Slave machine on Windows. On slave machine I have an ANT file that invoked a .bat file using

<exec executable = "<some-location>\applicationService.bat" > <arg value = "start"> </exec>

Using Jenkins Job I am invoking this ANT file. This ANT file runs Successfully(shown on Jenkins console logs) but the service is not started. I did check the task-Manager and logs. This applicationService.bat starts a Java Spring service. When I manually run this ANT on slave machine it works as expected.

Please suggest.

created Slave using these steps : https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines+on+Windows

2

2 Answers

0
votes

When I manually run this ANT on slave machine it works as expected.

The fact that you can do it manually says that your case is a permissions issue

  • Make sure that you connecting slave as administrator and user that runs jenkins jobs on slave has permissions to start Java Spring service.
0
votes

Under Windows, bat files need to be executed from cmd with the /c switch, rather than directly as their own executables.

<exec executable="cmd">
    <arg value="/c" />
    <arg value="path/to/file/location/applicationService.bat" />
    <arg value="start" />
</exec>