0

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?

10
  • can you post your command + windows doesn't have this directory structure generally /hosting/workspace/myProject Commented Jul 11, 2014 at 17:44
  • runs jenkins on windows? Commented Jul 11, 2014 at 17:46
  • @JigarJoshi java -jar target/myProject.jar. This is the windows batch command i put in the Execute Windows Command in jenkins Commented Jul 11, 2014 at 17:47
  • 3
    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 Commented Jul 11, 2014 at 17:52
  • 1
    where was this upvote coming from and why... ? Commented Jul 11, 2014 at 17:56

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I agree to what you have said. But doesn't Jenkins have an option to build in a windows environment independent of OS it is running on?
Nope, hence the need for a distributed architecture : wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.