As per the documentation @grap is an option but it is not recommended. You should either create a shared library or call `sh java jar...` and it all depends on what you need.
On Mon, Dec 14, 2020 at 11:12 AM Yeikel <yeike...@gmail.com> wrote: > How about shared libraries? > > https://www.jenkins.io/doc/book/pipeline/shared-libraries/ > > On Mon, Dec 14, 2020 at 10:55 AM Charles Moulliard <cmoul...@redhat.com> > wrote: > >> Hi, >> >> How can we Import a java jar on jenkins in order to allow a Groovy Script >> part of a Job DSL to use java classes packaged within the jar file ? >> >> Example of groovy script using the Java class Hello and method "message" >> >> package groovy >> import dev.snowdrop.jenkins.Hello; >> println new Hello().message(); >> >> Cheers >> >> Charles >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to jenkinsci-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-users/d28daa31-1da7-423c-ab7c-f14820f985ecn%40googlegroups.com >> <https://groups.google.com/d/msgid/jenkinsci-users/d28daa31-1da7-423c-ab7c-f14820f985ecn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMMhyA2sskHbrH7ANQijNLVXLkAF0G0-8ccgEqCE-cqV%2Bt7GvQ%40mail.gmail.com.