- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 groovy 的新手,目前正在尝试将我的团队 Jenkins 服务器从 1.6 更新到 2.7。我需要迁移的部分之一是我们在版本控制中拥有的 Job DSL。
在新服务器上,当我尝试运行旧作业 DSL 时,出现以下错误:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/apps/Jenkins/workspace/DSL-infrastructure/shared/Shared.groovy: 10: Apparent variable 'com' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a class name or statically imported field. Please check the spelling.
You attempted to use a method 'com' but left out brackets in a place not allowed by the grammar.
@ line 10, column 17.
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
^
基本上,我认为问题是 groovy 脚本找不到 com.cloudbees... 包。
Shared.groovy 脚本部分:
static def getCred(partialName) {
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class,
jenkins.model.Jenkins.instance,
null,
null
)
creds.find { it.description.contains(partialName) }
}
我到处搜索,终究无法弄清楚为什么或如何解决这个丢失包裹的问题。当我在 apache tomcat 中运行 Jenkins 时,它变得很复杂。
我不确定如何在运行 Jenkins 的 apache tomcat 服务器中导入这个丢失的包?我在目录中找到了 .jar 文件:
/apps/jenkins/plugins/credentials/WEB-INF/lib/credentials.jar
我要引用的特定类:
任何帮助将不胜感激
最佳答案
自 Job DSL 插件版本 1.43 起,来自 Credentials 插件的类在 DSL 脚本中不再可用。因此,您在更新 Jenkins 时可能还更新了 Job DSL 插件。
Credentials plugin 的 1.21+ 版本允许为凭据指定自定义 ID,因此不必通过描述查找凭据。只需使用描述性 ID。
关于tomcat - Groovy 帮助查找丢失的包 : com. cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials package not found, Jenkins Job DSL plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40457223/
我已通过 relevant documentation 中的 9 个步骤将我的用户池设置与联合身份流程集成在一起.我正在关注文档并使用增强的身份验证流程。 然而,还有一个我不太明白的额外步骤可能导致我
我通过以下方式使用 LibGit2Sharp.Credentials 类一段时间: LibGit2Sharp.Credentials credentials = new UsernamePasswor
我正在 Android 中编写一个应用程序,它使用我创建的一些 REST 服务。这些 Web 服务不会发出标准的 Apache Basic 质询/响应。相反,在服务器端代码中,我想从 HTTP(S)
我正在尝试使用 AWS Cognito 实现 Facebook 登录。从 Facebook 收到访问 token 后,我无法更新凭据提供程序。 let token = FBSDKAccessToken
我是 groovy 的新手,目前正在尝试将我的团队 Jenkins 服务器从 1.6 更新到 2.7。我需要迁移的部分之一是我们在版本控制中拥有的 Job DSL。 在新服务器上,当我尝试运行旧作业
我是一名优秀的程序员,十分优秀!