Summary
We started this chapter by learning what a shared library is. We went through the three directories in a shared library and discussed how the vars
directory holds the helper functions, the src
directory holds the Groovy class files, and the resources
directory holds the static files.
We created a shared library in a GitHub repository by adding a sample code that reads a file from the resources
directory, then prints a random line from the file.
Then we learned the two different ways of providing a shared library. We learned that a global shared library should be used to provide globally useful helper functions, and that a folder-level shared library should be used for anything else.
Then we went through the five different ways of loading a shared library. We saw how we can load a library statically, dynamically, and with or without importing a class in the src
directory. We saw how each one differs and discussed when we should use one over another.
Once...