Introduction
When running Jenkins pipelines, you often need specific software like Java or Maven. The tools directive helps Jenkins automatically install and use these tools during your build, so you don't have to set them up manually on every machine.
When you want Jenkins to automatically install Java before running your build.
When your pipeline needs Maven to build a Java project without manual setup.
When you want to ensure consistent tool versions across different build agents.
When you want to avoid errors caused by missing or wrong tool versions on agents.
When you want to simplify pipeline scripts by declaring required tools upfront.