我在做一个流水线,当在我的项目中做一个mvn clean install命令时,出现这个错误mvn not reconegize为一个内部命令或外部,一个可操作的程序或一个批处理文件.我的项目是一个Maven java项目,我的操作系统是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
}
}
}
}
}
看来你的代理没有安装maven。另外,请检查maven是否安装在这里提到的路径上。