Created
May 29, 2018 02:10
-
-
Save saiyam1814/de8e7cafe474260ae4b3baf3a1d46dd6 to your computer and use it in GitHub Desktop.
How To run MAVEN commands as Jenkins User
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You might encounter into an issure where you are running a Jenkins Job and you have Maven commands in that and you might be facing 2 types of issues: | |
1) mvn command not found | |
2) cannot create the repository | |
So if you just have installed maven as root so you need to change the settings.xml | |
go to settings.xml and put <localRepository>/var/lib/jenkins/.m2/repository</localRepository> | |
also export the environment variables. | |
export M2_HOME=/usr/local/apache-maven-3.5.3 | |
export PATH=$PATH:$M2_HOME/bin | |
export JAVA_HOME=/opt/jdk1.8.0_171 | |
Now Jenkins user also might not be able to get these environmet variables so set them as environment variables in jenkins configuration as well. | |
Once you have the correct Environment variables set and the localRepository you are GOOD to GO..! | |
#DevOpsRocks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment