how to specify the pom.xml path in jenkins pipeline script

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


how to specify the pom.xml path in jenkins pipeline script



my maven project looks like below
working dir
Jenkins error



this is how my script looks like



node {
stage ('Build') {


git url: 'https://github.com/rakshitha2/test_proj.git'

def mvnHome = tool 'M3'



bat "${mvnHome}binmvn -B install"



}
}



I have to go inside parent directory and execute maven command in Jenkins pipeline script.
I tried specifying POM path in MVN command its giving me an error saying "path is unexpected at this time". but the same is working in my local.



I'm new to Jenkins and groovy. kindly help me with this.





add you pom.xml to question and the log of the error so people can understand the issue
– user7294900
Jun 15 '17 at 7:21





Hi, issue is not with the pom, I need to go inside parent directory where pom is located and execute the MVN command. but still I'm adding my error screen shot
– thakshira
Jun 15 '17 at 7:23




2 Answers
2



As it is basically a normal maven mechanism. So


sh 'mvn -f otherdirectory/pom.xml clean install'


pipeline {
agent any
tools {
maven 'mavenHome'
jdk 'JavaHome'
}
stages {
stage('Build') {
steps {
echo 'maven clean'
//ABC indicates the folder name where the pom.xml file resides
bat ' mvn -f ABC/pom.xml clean install'
}
post {
success {
echo 'Now Archiving'
}
}
}
}
}






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

gUS6w,ms,lDA b,P3ZIy4p,tzkKDDc,y0m0hMAxa1ojAsZt,UMLm8BPf0o Ih7fqKG6FYgac4 NVSCK 8QP,x4aVk6Kf,BEap,uY MS3
fBH,aD3

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results