I'm doing a pipeline, when doing a mvn clean install command in my project, this error mvn not reconegize as an internal command or external, an operable program or a batch file. My project is a Maven java project, my operating system is windows 10
JenkinsFile
pipeline {
agent any
stages {
stage('Unit tests') {
steps {
// Run the maven build
// if (isUnix()) {
// sh "'${mvnHome}/bin/mvn' clean test -Dtest=TestRunner"
// } else {
bat 'mvn clean test'
// }
}
}
stage("build & SonarQube analysis"){
agent any
steps {
withSonarQubeEnv('My SonarQube Server') {
bat 'C:/Users/ANTONIO/Documents/sonar-scanner-4.2.0.1873-windows/bin/sonar-scanner'
}
}
}
stage("Quality Gate") {
steps {
timeout(time: 1, unit: 'HOURS') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
waitForQualityGate abortPipeline: true
}
}
}
}
}
It seems your agent does not have maven installed on it. Also, check if maven is installed on the path mentioned here.