Interview Prep/Jenkins/Shared libraries

Why must classes in `src/` implement `Serializable`?

IntermediateConceptShared libraries
Answer

Library classes run under CPS like the Jenkinsfile. If an instance is alive when a step executes (for example a Deployer object held in a variable while sh runs), CPS serializes it. A class without Serializable causes NotSerializableException. Fields that hold non-serializable objects must be transient or avoided.

All Jenkins questions Roadmap: Jenkins

More on Shared libraries