我的Jenkinsfile中有以下管道:
pipeline {
agent any
stages {
stage("Compile") {
steps {
sh "./mvnw clean package"
}
}
stage("Unit test") {
steps {
sh "./mvnw test"
}
}
}
}
构建失败,日志如下:
...
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Compile)
[Pipeline] sh
[calculator] Running shell script
+ ./mvnw clean package
/var/lib/jenkins/workspace/calculator@tmp/durable-ed9b8653/script.sh: 2: /var/lib/jenkins/workspace/calculator@tmp/durable-ed9b8653/script.sh: ./mvnw: Permission denied
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Unit test)
Stage "Unit test" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 126
Finished: FAILURE
我已将mvnw的权限设置为777,但无法解决问题。 谁能告诉我解决方案?