Answer a question

Following the remarkably terse docs here: https://www.jenkins.io/doc/book/pipeline/shared-libraries/#using-third-party-libraries

I am trying to use @Grab to access a third party library from Jenkins.

@Grab(group='org.jsoup', module='jsoup', version='1.13.1') is in a Groovy class in a library. The library is specified in Jenkins/configure under Global Pipeline Libraries

Sharable libraries available to any Pipeline jobs running on this system. These libraries will be trusted, meaning they run without “sandbox” restrictions and may use @Grab.

I am not using the default branch of the library, but I am not sure whether that is relevant to my problem.

When running the pipeline, I get the following error:

java.lang.SecurityException: Annotation Grab cannot be used in the sandbox. at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.RejectASTTransformsCustomizer

Any hints would be deeply appreciated

Answers

This article on russian describes details about it: https://habr.com/ru/post/338032/
Summary: you need to create separate libarary in SCM and use Grab there.

Logo

CI/CD社区为您提供最前沿的新闻资讯和知识内容

更多推荐