Cannot run program "mvn" error=2, No such file or directory Cannot run program "mvn" error=2, No such file or directory jenkins jenkins

Cannot run program "mvn" error=2, No such file or directory


There are multiple things here.

You either didn't select Maven version in Job configuration.Or you didn't configure Jenkins to install a Maven version.Or you expected to use locally installed Maven on the Slave, but it's not configured for jenkins user.

Since I don't know what you've configured (or didn't configure) and what you expected to use, I can't answer directly, but I can explain how it works.

If you want to use locally installed Maven on master/slave

  • You must have Maven locally installed
  • You must be able to launch it with jenkins user
    1. Execute sudo jenkins, and then execute mvn on your Slave to verify that jenkins user can run mvn
    2. If that fails, you need to properly install/configure Maven
  • In Job configuration, for Maven Version, you must select Default. This is the setting that uses the version that's installed locally on the node

If you want to have Jenkins install Maven for you

  • You must go to Jenkins Global Tool Configuration, and configure a Maven version with automatic installer (from the web).
  • In Job configuration, for Maven Version, you must select that particular version that you've just configured.


If you are just looking for simplest solution then you should go to global jenkins configuration

http://localhost:32773/configureTools/

And configure maven like that

enter image description here

Then you have to go to your project. Inside settings you have build. Chose maven which you have created a minute ago.

enter image description here


I had the same problem and i installed maven in Jenkins Server and issue was fixed.

sudo yum install maven