Groovy jenkins Grab ERROR

时间:2016-10-05 14:07:15

标签: jenkins groovy httpbuilder

我正在尝试在Jenkins上运行一个groovy脚本。我使用"执行系统groovy脚本"。我的脚本需要使用REST,因此我需要http-builder。以下是我尝试获取它的方法:

@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1') 

import groovyx.net.http.HTTPBuilder

但是,当我按下检查语法按钮时,我收到以下错误:

javax.servlet.ServletException:java.lang.NoClassDefFoundError:org / apache / ivy / core / settings / IvySettings     在org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)     在org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)     在org.kohsuke.stapler.MetaClass $ 5.doDispatch(MetaClass.java:233)     在org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)     在org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)     在org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)     在org.kohsuke.stapler.MetaClass $ 5.doDispatch(MetaClass.java:233)     在org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)     在org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)     在org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)     在org.kohsuke.stapler.MetaClass $ 5.doDispatch(MetaClass.java:233)     在org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)     在org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)     在org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)     在org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)     在org.kohsuke.stapler.Stapler.service(Stapler.java:238)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:790)     在org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)     在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1669)     在hudson.util.PluginServletFilter $ 1.doFilter(PluginServletFilter.java:135)     在hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126)     在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1652)     在hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)     在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1652)     在hudson.security.ChainedServletFilter $ 1.doFilter(ChainedServletFilter.java:84)     at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)     在hudson.security.ChainedServletFilter $ 1.doFilter(ChainedServletFilter.java:87)     在jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)     在hudson.security.ChainedServletFilter $ 1.doFilter(ChainedServletFilter.java:87)     在org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)     在hudson.security.ChainedServletFilter $ 1.doFilter(ChainedServletFilter.java:87)     在org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:135)     在hudson.security.ChainedServletFilter $ 1.doFilter(ChainedServletFilter.java:87)     at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)     在hudson.security.ChainedServletFilter $ 1.doFilter(ChainedServletFilter.java:87)     在jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)     在hudson.security.ChainedServletFilter $ 1.doFilter(ChainedServletFilter.java:87)     at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)     在hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)     在hudson.security.ChainedServletFilter $ 1.doFilter(ChainedServletFilter.java:87)     在hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)     在hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)     在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1652)     at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)     在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1652)     在hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)     在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1652)     在org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)     在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1652)     在org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)     在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)     at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)     在org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)     at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)     在org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)     在org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)     at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)     在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)     在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)     在org.eclipse.jetty.server.Server.handle(Server.java:499)     在org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)     在org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)     在org.eclipse.jetty.io.AbstractConnection $ 2.run(AbstractConnection.java:544)     在winstone.BoundedExecutorService $ 1.run(BoundedExecutorService.java:77)     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)     在java.lang.Thread.run(未知来源) 引起:java.lang.NoClassDefFoundError:org / apache / ivy / core / settings / IvySettings     at java.lang.Class.getDeclaredMethods0(Native Method)     at java.lang.Class.privateGetDeclaredMethods(Unknown Source)     at java.lang.Class.privateGetPublicMethods(Unknown Source)     at java.lang.Class.getMethods(Unknown Source)     at java.beans.Introspector.getPublicDeclaredMethods(Unknown Source)     at java.beans.Introspector.getTargetMethodInfo(Unknown Source)     at java.beans.Introspector.getBeanInfo(Unknown Source)     at java.beans.Introspector.getBeanInfo(Unknown Source)     at groovy.lang.MetaClassImpl $ 15.run(MetaClassImpl.java:3290)     at java.security.AccessController.doPrivileged(Native Method)     at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3288)     at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3265)     at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:254)     at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:285)     在groovy.grape.GrapeIvy。$ getStaticMetaClass(GrapeIvy.groovy)     在groovy.grape.GrapeIvy。(GrapeIvy.groovy:81)     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)     at java.lang.reflect.Constructor.newInstance(Unknown Source)     在java.lang.Class.newInstance(未知来源)     在groovy.grape.Grape.getInstance(Grape.java:121)     在groovy.grape.Grape.grab(Grape.java:159)     at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:378)     at org.codehaus.groovy.transform.ASTTransformationVisitor $ 3.call(ASTTransformationVisitor.java:321)     在org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931)     在org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)     在org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)     在org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)     在groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)     在groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)     在groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)     在groovy.lang.GroovyShell.parse(GroovyShell.java:700)     在groovy.lang.GroovyShell.parse(GroovyShell.java:736)     在groovy.lang.GroovyShell.parse(GroovyShell.java:727)     at hudson.plugins.groovy.StringScriptSource $ DescriptorImpl.doCheckScript(StringScriptSource.java:71)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)     at java.lang.reflect.Method.invoke(Unknown Source)     在org.kohsuke.stapler.Function $ InstanceFunction.invoke(Function.java:324)     在org.kohsuke.stapler.Function.bindAndInvoke(Function.java:167)     at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:100)     在org.kohsuke.stapler.MetaClass $ 1.doDispatch(MetaClass.java:124)     在org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)     在org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)     ......还有66个 引起:java.lang.ClassNotFoundException:org.apache.ivy.core.settings.IvySettings     at java.net.URLClassLoader.findClass(Unknown Source)     at java.lang.ClassLoader.loadClass(Unknown Source)     at java.lang.ClassLoader.loadClass(Unknown Source)     在org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:450)     在org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403)     ... 112更多

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我找到了问题的答案。它是将ivy.jar下载并复制到Jenkins lib目录(例如C:\ Program Files(x86)\ Jenkins \ war \ WEB-INF \ lib)并重新启动Jenkins(例如通过系统服务),它是'然后可以从脚本控制台使用@Grab。进一步阅读:https://groups.google.com/forum/#!msg/job-dsl-plugin/EG6eqQYYI7M/2TKKysNw4QEJ