Jenkins Нет таких плагинов свойств для класса - PullRequest
0 голосов
/ 07 июля 2019

Я пытаюсь запустить скрипт для настройки конфигурации плагина Jenkins Slack. Версия Дженкинса - 2.150.2. Версия плагина Slack: 2.4.

Когда скрипт запускается, я получаю сообщение об ошибке:

No such property: plugins for class: hudson.model.Hudson

Я тоже пытался использовать com.cloudbees.plugins, но он тоже не работает. Когда я использую это, я получаю следующую ошибку:

No such property: com for class: RemoteClass

Код здесь:

https://github.com/jenkinsci/slack-plugin/issues/427#issuecomment-444024289

Код помещается в myscript.groovy и запускается с:

java -jar jenkins-cli.jar -s http://localhost:8080 -"remoting" groovy myscript.groovy

Я ожидаю, что этот код будет работать. Проблема с GitHub закрыта, и есть сообщение о том, что она работает.

Что происходит, я получаю следующую ошибку:

ERROR: Unexpected exception occurred while performing groovy command.
groovy.lang.MissingPropertyException: No such property: plugins for class: hudson.model.Hudson
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
    at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:66)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
    at RemoteClass.run(RemoteClass:33)
    at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
    at groovy.lang.GroovyShell.run(GroovyShell.java:518)
    at groovy.lang.GroovyShell.run(GroovyShell.java:497)
    at hudson.cli.GroovyCommand.run(GroovyCommand.java:89)
    at hudson.cli.CLICommand.main(CLICommand.java:283)
    at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:95)
    at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:929)
    at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:903)
    at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:855)
    at hudson.remoting.UserRequest.perform(UserRequest.java:212)
    at hudson.remoting.UserRequest.perform(UserRequest.java:54)
    at hudson.remoting.Request$2.run(Request.java:369)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:66)
    at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
    at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
    at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
    at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Это вызывается из строки 27:

def slack = jenkins.getDescriptorByType(jenkins.plugins.slack.SlackNotifier.DescriptorImpl.class)

1 Ответ

0 голосов
/ 07 июля 2019

В Groovy вы не используете синтаксис Java .class для ссылки на литерал класса; вы просто используете имя класса (jenkins.plugins.slack.SlackNotifier.DescriptorImpl). .class здесь эквивалентно вызову getClass() для объекта Class<DescriptorImpl>.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...