2016-07-21 96 views
0

该脚本在groovy控制台中工作正常。但是,当我做检查的语法在詹金斯相同的脚本,以下错误消息来了 -无法编译Jenkins中的groovy脚本

Script1.groovy: 6: unable to resolve class groovyx.net.http.RESTClient 
@ line 6, column 1. 
import groovyx.net.http.RESTClient 
^ 
Script1.groovy: 4: unable to resolve class groovyx.net.http.ContentType 
@ line 4, column 1. 
import groovyx.net.http.ContentType 
^ 
Script1.groovy: 3: unable to resolve class groovyx.net.http.HTTPBuilder 
@ line 3, column 1. 
import groovyx.net.http.HTTPBuilder.... 

如何获得这个问题解决了吗?

回答

1

这个异常是因为你没有这些依赖关系(瓶),所以你必须有这些类两个可选: 1 - 如果你正在使用像任何依赖管理框架(行家,gradle产出),那么只需要添加这些依赖 2 - 在顶部的常规文件中添加@Grapes然后添加这里的依赖性的例子:

@Grapes(
     @Grab(group='yourDependencyGroupID', module='yourDependencyArtifactID' 
              , version='theDesireVersion') 
    ) 

可以为这些依赖搜索在Maven Repository

我希望这将有助于:)

+0

感谢支持Salem。我能够通过上述解决方案解决问题。 – user6619281