I had exactly the same problem with building project, when I was following through tutorial placed in book Jenkins:The Definitive Guide.
I had Jenkis (jenkins-1.502.msi) instaled on Windows7 64 as a service - whatever I tried always received:
[workspace] $ mvn.bat
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn.bat" (in directory "C:\Work\jenkins\jobs\gameoflifedefault\workspace"): CreateProcess error=2, The system cannot find the file specified
Unfortunately I didn't managed to resolve this jenkis service problem but found another solution to make it work on Windows:
Use Apache Tomcat java server - if you have properly configured Tomcat do:
- Download jenkins.war
- Place it in webapps folder in your Tomcat directory
- Run Tomcat and check via
http://localhost:8080/manager
if jenkins is there
- Go to
http://localhost:8080/jenkins
Now mvn.bat is seen and my build run without problems.
Ofcourse I understand that maven is properly configured on your system - so you should had specified in environmental variables:
- variable: M2
value: %M2_HOME%\bin
- variable: M2_HOME
value: C:\yourPathToMaven\apache-maven-3.0.4
- variable: PATH
add to existing value: %M2_HOME%;
To check if maven is visible type in comand promp:
C:\Users\x>mvn --version
You should get something like:
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: C:\Work\Maven\apache-maven-3.0.4
Java version: 1.7.0, vendor: Oracle Corporation
Java home: C:\Work\ja\jdk1.7.0_10\jre
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Hope it helps.