Interview Prep/CI/CD/Jenkins Pipelines and Agents

Builds on a single agent are slow because every build downloads the same Maven dependencies. What do you do?

IntermediateScenarioJenkins Pipelines and Agents
Answer

Situation read → No dependency cache, or a cold ephemeral agent each time.

What I'd do →

  1. Point Maven at a Nexus/Artifactory proxy repository in settings.xml so downloads are LAN-fast and cached.
  2. On static agents keep ~/.m2 persistent; on Kubernetes mount a shared PVC or use a pre-warmed image.
  3. Use mvn -B -T 1C for parallel module builds and the Maven build cache extension where appropriate.

Why → A repository proxy is the most robust cache because it is shared by all agents and CI users.

Interview tip → Proxying also protects you if Maven Central is unavailable.

All CI/CD questions

More on Jenkins Pipelines and Agents