Where Can I Find Jenkins Build Scripts in the jenkinsci/jenkins Repository?
Jenkins build scripts are located in the root pom.xml and module-specific pom.xml files throughout the repository, with the CI pipeline defined in the Jenkinsfile at the repository root.
Jenkins is built using Apache Maven with a multi-module project structure. If you're looking for where to find Jenkins build scripts, you'll discover the core build definitions in Maven POM files distributed across the repository, while the continuous integration logic lives in the root Jenkinsfile. This setup ensures consistent builds whether you're compiling locally or running on the Jenkins CI infrastructure.
Root Build Configuration
The primary entry point for building Jenkins is the root pom.xml located at the repository base. According to the jenkinsci/jenkins source code, this file declares the parent POM and aggregates all sub-modules including core, war, plugins, and test utilities.
The root pom.xml supplies:
- Global Maven properties and dependency management
- The list of modules to build in the reactor
- Plugin configurations inherited by all child modules
Running mvn clean install from the repository root triggers Maven to process this parent POM and sequentially build each module while respecting inter-module dependencies.
Module-Specific Build Scripts
Each major component maintains its own pom.xml that inherits from the root POM. These module-specific build scripts add component-specific dependencies, source sets, and build plugins.
Core Module
The core/pom.xml defines the build for Jenkins' core Java libraries. This is where the main application code compiles before being packaged into the final WAR artifact.
War Module
The war/pom.xml handles packaging the web application archive. This module takes the compiled core and bundles it with web resources to produce jenkins.war. According to the source code, the final artifact is written to war/target/jenkins.war after a successful build.
CLI Module
The cli/pom.xml builds the command-line interface tools that allow remote interaction with Jenkins instances. This separates the CLI utilities from the core web application while maintaining dependency alignment through the parent POM.
CI Pipeline Configuration
The Jenkinsfile at the repository root defines the continuous integration stages used by the Jenkins project itself. As implemented in jenkinsci/jenkins, this file drives the official CI pipeline on Jenkins infrastructure using Docker-based agents.
The Jenkinsfile invokes the same Maven commands available to local developers, ensuring identical builds between development environments and the CI system. It also archives the resulting war artifact and publishes test reports after completion.
Supplementary Build Scripts
While Maven handles the primary build, the repository includes ath.sh for acceptance test harness execution. This shell script exists at the repository root and provides helper functionality for test setups, though it is not part of the main Maven build lifecycle.
How to Build Jenkins Locally
You can reproduce the official build using standard Maven commands.
Fast build (skips tests):
cd /path/to/jenkins
mvn clean install -DskipTests
Full build with verification:
mvn clean verify
Running the CI pipeline locally with Docker:
docker run --rm -v "$(pwd)":/workspace -w /workspace maven:3.9.6 mvn clean verify
Locating the build output:
After mvn clean install completes, the runnable WAR file is available at:
ls war/target/jenkins.war
You can launch this directly:
java -jar war/target/jenkins.war
Summary
- Root
pom.xml– Defines the parent POM and aggregates all modules for the Maven reactor - Module POMs –
core/pom.xml,war/pom.xml, andcli/pom.xmlhandle component-specific builds and dependencies Jenkinsfile– Drives the official CI pipeline using Docker-based Maven executionath.sh– Auxiliary shell script for acceptance test harness setup- Build output – The final
jenkins.waris generated underwar/target/after successful compilation
Frequently Asked Questions
Where is the main Jenkins build script located?
The main build script is the root pom.xml at the repository base. This Maven Project Object Model file defines the multi-module structure and serves as the entry point for both local builds and CI execution. All other build configurations inherit from this parent POM.
What build tool does Jenkins use?
Jenkins uses Apache Maven as its primary build tool. The entire project follows standard Maven conventions with a multi-module layout where the root POM aggregates sub-modules like core, war, and cli. Maven's reactor ensures dependencies between modules are respected during the build process.
How do I build the Jenkins WAR file locally?
Run mvn clean install from the repository root. After the build completes, the WAR file is located at war/target/jenkins.war. You can skip tests for faster compilation using mvn clean install -DskipTests, though running mvn clean verify is recommended for a complete build with validation.
What is the purpose of the Jenkinsfile in the repository?
The Jenkinsfile defines the continuous integration pipeline for the Jenkins project itself. It specifies stages for checkout, compilation, testing, and packaging using Docker-based agents. This file ensures that official CI builds use the same Maven commands and environment that developers use locally.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →