如何解决有没有办法解决错误:在 Jenkins 中找不到指定的 Maven 安装
我在 localhost:8080 上运行 Jenkins。我刚刚开始处理管道工作。我在我的脚本中创建了一个基本的 jenkinsfile 用于运行带有黄瓜测试的硒,并在 macOS 上的 Jenkins 中创建了一个声明性管道作业
我的 jenkinsfile 看起来像这样:
pipeline {
agent any
stages {
stage ('Compile Stage') {
steps {
withMaven(maven : 'maven_3_6_3') {
sh 'mvn clean install'
}
}
}
stage ('Testing Stage') {
steps {
withMaven(maven : 'maven_3_6_3') {
sh 'mvn test'
}
}
}
stage ('Cucumber Reports') {
steps {
cucumber buildStatus: "UNSTABLE",fileIncludePattern: "**/cucumber.json",jsonReportDirectory: 'target'
}
}
}
}
在 Jenkins 中构建作业时,我收到此错误:
ERROR: Could not find specified Maven installation 'maven_3_6_3'.
Finished: FAILURE
这是完整的日志:
Started by user unknown or anonymous
Obtained XeDemo/jenkinsfile from git https://myrepo@bitbucket.org/myrepo/repo.git
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /Users/jo/.jenkins/workspace/DeclarativePipelineDemo
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
The recommended git tool is: git
using credential e2105da7-be79-42ae-a46d-86a636071021
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://myrepo@bitbucket.org/myrepo/repo.git# timeout=10
Fetching upstream changes from https://myrepo@bitbucket.org/myrepo/repo.git
> git --version # timeout=10
> git --version # 'git version 2.24.3 (Apple Git-128)'
using GIT_ASKPASS to set credentials
> git fetch --tags --force --progress -- https://myrepo@bitbucket.org/myrepo/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision f2c0bef8083d26f1cjo07197940b7d58ce4bdd3 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f f2c0bef8083d26f1cjo07197940b7d58ce4bdd3 # timeout=10
Commit message: "Reformat code"
> git rev-list --no-walk f2c0bef8083d26f1cjo07197940b7d58ce4bdd7 # timeout=10
The recommended git tool is: git
using credential e2105da7-be79-42ae-a46d-86a636071021
> git rev-parse HEAD^{commit} # timeout=10
The recommended git tool is: git
using credential e2105da7-be79-42ae-a46d-86a636071021
[GitCheckoutListener] Recording commits of 'git https://myrepo@bitbucket.org/myrepo/repo.git'
[GitCheckoutListener] Found previous build 'DeclarativePipelineDemo #19' that contains recorded Git commits
[GitCheckoutListener] -> Starting recording of new commits since 'f2c0bef8083d26f1cjo07197940b7d58ce4bdd3’
[GitCheckoutListener] -> Git commit decorator successfully obtained 'hudson.plugins.git.browser.BitbucketWeb@6f02a6f3' to render commit links
[GitCheckoutListener] -> No new commits found
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Compile Stage)
[Pipeline] withMaven
[withMaven] Options: []
[withMaven] Available options:
[withMaven] using JDK installation provided by the build agent
[Pipeline] // withMaven
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Testing Stage)
Stage "Testing Stage" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Cucumber Reports)
Stage "Cucumber Reports" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Could not find specified Maven installation 'maven_3_6_3'.
Finished: FAILURE
为了解决这个问题,我在Jenkins设置的全局工具配置中提供了maven、java和git路径,不知道为什么还是找不到指定的maven安装。我是 Jenkins 应用程序的唯一用户。我做错了什么?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。