11

So here is my project setup

  1. A separate groovy project
  2. Multiple pipelines

All the pipeline scripts refer to the shared groovy project. I went through the shared libraries and all of the needs to be registered in Jenkins global configuration.

Is there any way to do without it? I tried using Grab but ended up with the error

java.lang.RuntimeException: No suitable ClassLoader found for grab
PrabhaT
  • 858
  • 3
  • 10
  • 22
  • 5
    the way jenkins pipeline shared libraries are supposed to be distributed and consumed is well documented. What is the reason you're not using the documented path? – mvk_il Sep 10 '17 at 18:48
  • 3
    Here: https://jenkins.io/doc/book/pipeline/shared-libraries/ – StephenKing Sep 11 '17 at 04:32
  • All examples are for Global Shared Library. Mine is simple but doesn't work. I have library extension.jar copied into my workspace. I need to refer the library through the pipeline code. – PrabhaT Sep 11 '17 at 18:44
  • I also don't want to refer to the git project as I have lot of dependencies in my project and would prefer to build a fatjar out of it. Please let me know if there are any solutions – PrabhaT Sep 12 '17 at 05:11
  • 4
    It's not clear to me what problems you are having. What are the limitations of using _Shared Library_ that are limiting you right now? What are you trying to accomplish? – mkobit Sep 17 '17 at 05:20
  • Shared libraries are of Groovy code. How did you put it in a `java`-jar file? Can you explain? – yorammi Apr 07 '18 at 02:57
  • agree with @mvk_il, use the documented Jenkins Shared Library approach. – Andrew Gray Jul 20 '18 at 05:31
  • I'm voting to close this as it is unclear what you are asking. – mkobit Jul 26 '18 at 12:52

1 Answers1

0

Firstly for Grab to work your Jenkins needs to have access to the internet.

Shared Libraries are definitely the way to go here.

Like many things the secret sauce is in the syntax.

Andrew Gray
  • 3,593
  • 3
  • 35
  • 62