0
votes

I am building a project using Maven and using Jenkins for continuos integration. After the maven build i am getting an executable jar in my target folder which i am trying to run using a windows batch command as build step. But when i put the command in the box under execute windows batch command i get the following error

"cmd /c call /tmp/hudson2033384960131825453.bat FATAL: command execution failed java.io.IOException: Cannot run program "cmd" (in directory "/hosting/workspace/myProject"): error=2, No such file or directory""

I am using mac OSX 10.9.3. The jenkins is deployed in a remote server which i don't have access to.

I want to execute this jar file as a build process. How can i do it?

2
can you post your command + windows doesn't have this directory structure generally /hosting/workspace/myProject - jmj
runs jenkins on windows? - Hank Lapidez
@JigarJoshi java -jar target/myProject.jar. This is the windows batch command i put in the Execute Windows Command in jenkins - user3246489
jenkins can execute batch script depending on OS it is running on, you can't ask jenkins running on linux to launch some windows specific commands - jmj
where was this upvote coming from and why... ? - sschrass

2 Answers

5
votes

You should not be expecting a windows batch command to be able to run on a mac. Jenkins is pretty cool, I agree, but it isn't magical.

Also, yes, it is a little confusing that the option is available to you even though you are on a Mac, but its there incase you have a linux / mac master with windows slave: https://issues.jenkins-ci.org/browse/JENKINS-17010?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab

You cannot execute a windows batch command on mac or linux, end of story.

1
votes

You are trying to launch windows command through jenkins on another operating system which is not going to work