'mvn' is not recognized as an internal or external command, operable program or batch file.

173 views
Skip to first unread message

sajith m p

unread,
Sep 15, 2023, 6:26:48 AM9/15/23
to Jenkins Users
Hello,

I am using a basic maven command mvn -v in  a job unded execute batch command. I am getting an error while build "'mvn' is not recognized as an internal or external command,
operable program or batch file."Please help me to resolve this error.

I have completed maven installations in manage jenkins with name as MAVEN_HOME and path as C:\Users\sajit\Maven\apache-maven-3.9.4.

Also, please find the environment variables:
M2_HOME : C:\Users\sajit\Maven\apache-maven-3.9.4
MAVEN_BIN: MAVEN_BIN : %M2_HOME%\bin
MAVEN_HOME : %M2_HOME%

Kindly help.

Thanks,
Sajith M P

John Patrick

unread,
Sep 15, 2023, 7:06:16 AM9/15/23
to jenkins...@googlegroups.com
Common issues I have to fix for people include;

Checking it's on the PATH, so for your example above it would be set PATH=%PATH%;$MAVEN_BIN%

Checking it's executable

Most of my projects have moved to Maven Wrapper, and developers forgot to check the exec bit is store in git, i.e. git update-index --chmod +x mvnw. Using maven wrapper allows projects and branches to controller the maven version used, so less setup/upgrade of developer machines or cicd hosts, checking new maven version as part of cicd pipeline.

John


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/653af6b1-55d9-479a-87c8-6dd6be58c849n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages