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}\\bin\\mvn -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.
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'
}
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With