jenkinsfile无法识别@Grab [英] jenkinsfile doesn't recognize @Grab

查看:145
本文介绍了jenkinsfile无法识别@Grab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用@Grab在我的Jenkinsfile中包含一个yaml解析库.我将这一行添加到我的Jenkinsfile中:

I want to use @Grab to include a yaml parsing library inside my Jenkinsfile. I add this line in my Jenkinsfile:

@Grab('org.yaml:snakeyaml:1.17')

https://bitbucket.org/asomov/snakeyaml

但是,Jenkins跑步无法识别此错误并返回错误.

However, the Jenkins run can't recognize this and return an error.

推荐答案

目前您不能在管道中使用@Grab.我怀疑它将添加为功能,因为Jenkins CPS需要源代码才能执行CPS转换,并且@Grab使用二进制依赖性.您只能从受信任的共享库中使用@Grab.来自文档:

You cannot use @Grab in pipelines at the moment. I doubt it will be added as a feature because Jenkins CPS needs source code to be able to perform CPS transofmrations, and @Grab uses binary dependencies. You can only use @Grab from trusted shared libraries. From the docmentation:

可以使用@Grab批注从受信任的库代码中使用通常在Maven Central中找到的第三方Java库.有关详细信息,请参见 Grape文档,但仅需简单放在:

It is possible to use third-party Java libraries, typically found in Maven Central, from trusted library code using the @Grab annotation. Refer to the Grape documentation for details, but simply put:

这篇关于jenkinsfile无法识别@Grab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆