gpt4 book ai didi

maven - Jenkinsfile 错误 - java.lang.NoSuchMethodError : No such DSL method 'withMaven' found among steps

转载 作者:行者123 更新时间:2023-12-04 05:11:34 31 4
gpt4 key购买 nike

我目前正在尝试使用 jenkinsfile 在 jenkins 中实现管道,并且我正在 Windows 机器上执行一个 maven 项目。我正在 jenkins 中创建一个管道作业,我已经在我的 github 存储库中 checkin 了这个文件,当我在 jenkins 中运行该作业时,出现以下错误。

我的 Jenkins 文件:

    pipeline {
agent any
stages {
stage('Compile stage') {
steps {
maven(maven : 'Maven_3.5.2'){
bat "mvn clean compile"
}
}
}

stage('testing stage') {
steps {
maven(maven : 'Maven_3.5.2'){
bat "mvn test"
}
}
}

stage('deployment stage') {
steps {
maven(maven : 'Maven_3.5.2'){
bat "mvn deploy"
}
}
}

}

}

当我通过 jenkins 工作运行它时,我遇到了以下错误-
Jenkins 错误:

java.lang.NoSuchMethodError: No such DSL method 'withMaven' found among steps [archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, getContext, git, input, isUnix, library, libraryResource, load, mail, milestone, node, parallel, powershell, properties, pwd, readFile, readTrusted, resolveScm, retry, script, sh, sleep, stage, stash, step, svn, timeout, timestamps, tm, tool, unarchive, unstash, validateDeclarativePipeline, waitUntil, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, wrap, writeFile, ws] or symbols [all, allOf, always, ant, antFromApache, antOutcome, antTarget, any, anyOf, apiToken, architecture, archiveArtifacts, artifactManager, authorizationMatrix, batchFile, booleanParam, branch,



有什么帮助吗?

最佳答案

这意味着您没有 withMaven作为一种可用的 DSL 方法。大多数情况下,这意味着您没有安装插件。在这种情况下,需要 Pipeline Maven 集成插件。 https://plugins.jenkins.io/pipeline-maven/

关于maven - Jenkinsfile 错误 - java.lang.NoSuchMethodError : No such DSL method 'withMaven' found among steps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47048960/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com