Interview Prep/CI/CD/Jenkins Build and Agent Failures

Jenkins console shows `sh: 1: mvn: not found` on one agent only.

BeginnerTroubleshootingJenkins Build and Agent Failures
Answer

Likely causes → Maven is not installed or not on PATH for that agent; the tools {} block is missing; the agent runs a non-login shell.

Diagnose →

ssh agent-b 'which mvn; echo $PATH; mvn -v'

Compare with a working agent, and check the node's "Tool Locations".

Fix → Declare tools { maven 'M3' } in the Jenkinsfile, or run the stage in a Maven container image.

Prevent → Build agents from one image or Packer template so tools are identical everywhere.

All CI/CD questions Roadmap: CI/CD fundamentals

More on Jenkins Build and Agent Failures