I have followed jenkins extending pipeline with shared libraries
it was mentioned that
The src directory should look like standard Java source directory structure. This directory is added to the classpath when executing Pipelines.
while the vars directory hosts scripts that define global variables accessible from Pipeline
Note: I am more curious about the difference in usage not in implementation.
Ok, well, you can see some sample differences in usage by simply examining the samples on the Extending with Shared Libraries page that you've probably already seen. For instance, if you look for the "Zot.groovy" example, you'll see that the code that uses this has to "new" the "Zot" class. However, if you look at the "vars/acme.groovy" sample, you'll see that the user code doesn't have to "new" anything, because the global variable named "acme" exists to be referenced by the script.
There are other differences, but that's one simple contrast.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With