Jenkins共享库加载失败-无法解析HTTPBuilder

时间:2019-05-27 11:39:20

标签: jenkins gradle groovy shared-libraries

我有一段使用groovyx.net.http.HTTPBuilder类的代码,这段代码驻留在资源库的src文件夹中,该资源库明确地作为Jenkins共享库加载。 我的build.gradle已经包含HTTPBuilder的依赖项。

一开始,pipelie作业在加载异常库时几秒钟就失败了

file:callService.groovy: 3: unable to resolve class groovyx.net.http.HTTPBuilder
 @ line 3, column 1.
   import groovyx.net.http.HTTPBuilder

build.grale内容

dependencies {
   compile(
      'org.codehaus.groovy:groovy-all:2.4.14',
      'org.codehaus.groovy.modules.http-builder:http-builder:0.7',
      'org.apache.httpcomponents:httpclient:4.5.2',
      'org.apache.httpcomponents:httpmime:4.5.2',
        )
}

我尝试使用抓取来解决某些帖子所建议的依赖关系,但没有用。

@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' )
import groovyx.net.http.HTTPBuilder

并抛出异常

hudson.remoting.ProxyException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during conversion: Error grabbing Grapes -- [unresolved dependency: org.codehaus.groovy.modules.http-builder#http-builder;0.7: not found]

更新:更正@Grab语句(通过用模块替换名称)并添加常春藤依赖项(org.apache.ivy:ivy:2.4.0)gradle的compileGroovy失败后,Caused by: java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport

在共享库中有使用HttpBuilder和相关类的简便方法吗?

0 个答案:

没有答案