私はGroovyを初めて使い、現在Jenkinsサーバーを1.6から2.7に更新しようとしています。私が移行する必要があるのは、バージョン管理のJob DSLです。新しいサーバーでGroovyが欠けているパッケージを見つける:com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentialsパッケージが見つからない、Jenkins 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(
^
は基本的に、私は問題がグルーヴィーなスクリプトが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) }
}
に私はハイとローで検索しましたし、私の人生のためになぜか、どのようにこの欠落しているパッケージの問題を解決するにはを把握することはできません。私がJenkinsをApache Tomcatの中で動かしていると、複雑になります。
この欠落しているパッケージをJenkinsを実行しているApache Tomcatサーバーにインポートする方法がわかりません。私は、ディレクトリ内の.jarファイルが見つかり:
/apps/jenkins/plugins/credentials/WEB-INF/lib/credentials.jar
を私が参照しようとしている特定のクラス:
任意の助けを大幅にバージョンの1.43以来
お返事ありがとうございます。私はJob DSLを書き直す必要があると感じていました。私はそれをつかまえて、私が答えを出すなら、ここに答えを掲示します。 –
Credentialsプラグインだけでどのように動作するかの例を表示できますか? – misha