Bala12
Bala12

Reputation: 129

Jenkins build issue Maven Home doesnt exist

I am getting the following error while doing the Jenkins build in slave servers. In Master server the build was working fine.

ERROR: Maven Home /bgl-build-1/usr/local/maven doesn?t exist

My setup consists of one Master and two Slave servers. Maven is installed in Master server. Slave doent have the maven. The setup was working fine earlier. Getting this error for the past two days,

The ".bashrc" file of slaves contains the maven path installed in the master server.

export EDITOR=/usr/bin/vim
export BGL_BUILD_1=/bgl-build-1
export JAVA_HOME=$BGL_BUILD_1/usr/java/default
export M2_HOME=$BGL_BUILD_1/usr/local/apache-maven-2.2.1
export PATH="$BGL_BUILD_1/usr/local/bin:$BGL_BUILD_1/usr/local/maven/bin:$BGL_BUILD_1/usr/java/default/bin:$PATH";
export PATH="/bgl-build-1/usr/local/maven/bin:$PATH";

I referred the similar post reg this issue I have an issue running a jenkins job in slave using maven (Maven home doesn´t exist)

My question is do i need to have maven in all the servers ( including slave) or I am missing some configuration reg master and slave setup in Jenkins.

My Jenkins version - 1.582

Maven version - 2.2.1

Upvotes: 8

Views: 32999

Answers (2)

froderik
froderik

Reputation: 4808

This issue may also appear when the maven version has been updated and the old version removed but the project still points to the old version. To solve it simply select the new version!

Upvotes: 0

Slav
Slav

Reputation: 27505

Yes, you need Maven on the slave in order to execute a Maven build on that slave.

There are 2 ways to get Maven onto that slave:

  • Manually install Maven on the OS level of that slave (available to everyone)
  • Let Jenkins install Maven on that slave (usable by Jenkins only, without affecting the rest of OS)

(You could have both methods too)

To let Jenkins install maven:

  • Under Global Configuration, find Maven Installations
  • Add a Maven installation, give it a name
  • Select the version you want
  • Select the source (automatic install should be fine)

Then when you configure your maven job:

  • If you select "default" Maven version, it will try to use what's on the OS level
  • If you select a named Maven version (as you named it in Global Configuration), it will use that particular version, and Jenkins will install that for you on demand.

Upvotes: 11

Related Questions