I use Jenkins in windows 7 environment for a simple test, and run into this error.
I used maven to create a java test project in my win7 computer. I checked that the maven works by running 'mvn test' successfully. The project folder structure looks like below:
ProjectDir
pom.xml
src
test
java
MyTest.java
run.bat
Then I set up Jenkins in the same machine and try to use Jenkins to control my local maven build.
In Jenkins 'source code management' option I choose 'None'. In Jenkins 'build step' option I choose 'Execute windows batch command' and use something like below:
cd /d ProjectDir
run.bat
and the content of run.bat is:
set PATH=%PATH% C:\Program Files\maven\apache-maven-3.3.3\bin
echo %PATH%
mvn test
All seems very straight forward, PATH shows it includes maven directory, but mvn is NOT recognized as a command. Jenkis console output as below:
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft Network Monitor 3\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Skype\Phone\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\maven\apache-maven-3.3.3\bin
ProjectDir>mvn test
'mvn' is not recognized as an internal or external command,
operable program or batch file.
The only thing that's suspicious in this whole process is that the PATH env variable is not the same for Jenkins and my user account. However I compensate this by appending the maven path in Jenkins environment.
So what is the problem that mvn is still not recognized? Any ideas?
Thanks.
apache-maven-3.3.3/bin
folder? – khmarbaisemvn -v
in your windows command line ? – appuMaven home: C:\Program Files\maven\apache-maven-3.3.3
. While in windows, I faced issues with the directories having space in between(hereProgram Files
). Can you try with settingPATH
with quoted maven path "C:\Program Files\maven\apache-maven-3.3.3\bin" – appu