A library class call fails with `unable to resolve class com.devopsshack.ImageTag`
IntermediateTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer
Likely causes → Library not loaded before the import, wrong package path (src/com/devopsshack/ImageTag.groovy must declare package com.devopsshack), library loaded with the dynamic library step (no compile-time import), or a typo.
Diagnose → Check the log for Loading library shack-lib@v1 and browse the library tag for the file path.
Fix → Use @Library('shack-lib@v1') import com.devopsshack.ImageTag at the top, align package declaration and folders, or access via library('shack-lib@v1').com.devopsshack.ImageTag.
Prevent → JenkinsPipelineUnit tests that load classes from src/.
More on Jenkinsfile syntax, Groovy & CPS errors
`WorkflowScript: 1: Missing required section "agent" @ line 1, column 1.`Beginner`Unknown stage section "step". Starting with version 0.5, steps in a stage must be in a ‘steps’ block.`Beginner`java.lang.NoSuchMethodError: No such DSL method 'withSonarQubeEnv' found among steps [archive, bat, build, ...]`Beginner`java.io.NotSerializableException: java.util.regex.Matcher`Advanced`java.io.NotSerializableException: groovy.json.internal.LazyMap`Intermediate`org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object`Intermediate