`java.lang.NoSuchMethodError: No such DSL method 'withSonarQubeEnv' found among steps [archive, bat, build, ...]`
BeginnerTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer
Likely causes → The plugin providing the step (SonarQube Scanner) is not installed or failed to load, or the step name is misspelled.
Diagnose →
curl -s -u admin:$TOKEN "https://jenkins/pluginManager/api/json?depth=1&tree=plugins[shortName,active,enabled]" | jq '.plugins[] | select(.shortName=="sonar")'
Check Manage Jenkins > Plugins > Installed and startup logs for load failures.
Fix → Add sonar to plugins.txt, rebuild the image, redeploy. Fix spelling if it is a typo.
Prevent → Keep a smoke pipeline that calls every step your library relies on, run after each image change.
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.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`groovy.lang.MissingPropertyException: No such property: IMAGE_TAG for class: groovy.lang.Binding`Beginner