How to Build Jenkins from Source Using Maven: Quick-Build and Full Build Guide

Run mvn -am -pl war,bom -Pquick-build clean install to compile Jenkins and produce a runnable jenkins.war in minutes while skipping the extensive integration test suite.

Building Jenkins from source requires navigating its multi-module Maven structure defined in the jenkinsci/jenkins repository. The top-level pom.xml aggregates modules for the core engine, web UI, and plugins, allowing you to build either a minimal WAR for local development or a complete distribution. This guide explains how to use the quick-build profile for rapid iteration and the full build process for comprehensive testing.

Prerequisites

You need JDK 21 or JDK 25 and Maven 3.9.6 or newer installed. The CONTRIBUTING.md file in the repository root specifies these exact requirements and toolchains configuration. Ensure your environment meets these versions, as the build enforces them strictly through the Maven enforcer plugin configured in the root pom.xml.

Clone the Repository

Download the source and enter the project directory:

git clone https://github.com/jenkinsci/jenkins.git
cd jenkins

This checkout includes the aggregator pom.xml, core/ module, war/ module, and the plugins/ directory containing individual plugin submodules.

Choose Your Build Strategy

The Jenkins Maven project supports two primary build modes. Select the quick-build profile for development or the default lifecycle for complete validation.

The quick-build profile, defined in the root pom.xml, compiles only the war and bom (Bill of Materials) modules required to produce jenkins.war. It skips functional tests, acceptance tests, and plugin compilation to minimize build time.

Execute the quick-build:

mvn -am -pl war,bom -Pquick-build clean install
  • -am (also-make): Builds all dependencies of the specified modules automatically.
  • -pl war,bom: Restricts the build to the WAR and BOM modules explicitly.
  • -Pquick-build: Activates the profile that disables lengthy test execution and frontend asset generation (unless -Dskip.yarn is omitted).

Upon completion, the file war/target/jenkins.war contains the runnable application.

Full Build (Complete Distribution)

To compile every plugin and run the full test matrix, omit the quick-build profile:

mvn clean install

According to the jenkinsci/jenkins source code, this processes all modules listed in the aggregator pom.xml, including the core/ engine, every plugin in plugins/, and the war/ packaging module. This process takes significantly longer because it executes unit tests, integration tests, and the acceptance-test harness validations.

Run Jenkins Locally

The war/pom.xml configures the Jetty Maven plugin to launch the compiled WAR directly. Set the required JVM module system flags and run:

MAVEN_OPTS='--add-opens java.base/java.lang=ALL-UNNAMED \
            --add-opens java.base/java.io=ALL-UNNAMED \
            --add-opens java.base/java.util=ALL-UNNAMED' \
mvn -pl war jetty:run

This command starts Jenkins on http://localhost:8080 using the artifact produced in war/target/. The -pl war flag limits execution to the WAR module, while jetty:run invokes the embedded server configuration.

Build Frontend Assets (Optional)

The Jenkins web interface resides in the war module and requires Node.js and Yarn for asset compilation. After the initial Maven build, build the UI:

export PATH=$PWD/node:$PWD/node/node_modules/corepack/shims:$PATH
yarn install
yarn start

The war/pom.xml automatically triggers yarn during the Maven build unless you pass -Dskip.yarn as a property. Running yarn start launches a Webpack development server with hot-reload for frontend development work.

Understanding the Maven Architecture

The Jenkins repository organizes code into a standard Maven multi-module layout. The root pom.xml serves as the aggregator, propagating common plugin configurations—such as Spotless for code formatting, Checkstyle for style enforcement, and Enforcer for version rules—to all child modules.

The core module (core/pom.xml) compiles into jenkins-core.jar, containing the main application logic. The war module (war/pom.xml) packages this JAR with web resources into the final jenkins.war artifact. The quick-build profile exploits this structure by overriding the default lifecycle in the root POM to exclude plugin modules and test execution, targeting only the artifacts necessary for a functional server.

Summary

  • Quick-build (-Pquick-build -pl war,bom) generates war/target/jenkins.war in minutes by skipping tests and plugins.
  • Full build (mvn clean install) compiles all plugins and runs the complete test suite, taking significantly longer.
  • Local execution requires mvn -pl war jetty:run with specific MAVEN_OPTS to handle Java module system restrictions.
  • Frontend assets in the war module require Node/Yarn and integrate automatically unless -Dskip.yarn is specified.
  • Key files: Root pom.xml for build logic, war/pom.xml for the runnable WAR, and CONTRIBUTING.md for environment prerequisites.

Frequently Asked Questions

How long does it take to build Jenkins from source?

Using the quick-build profile, compilation finishes in 5–10 minutes on modern hardware, generating war/target/jenkins.war. A full build including all plugins and the acceptance-test harness requires 30–60 minutes or more, depending on your system resources and network speed for dependency resolution.

Can I build Jenkins without running tests?

Yes. Append -Pquick-build to your Maven command to skip the majority of unit and integration tests, or add -DskipTests to any command to bypass the test phase while still compiling source code. The quick-build profile is defined in the root pom.xml specifically for this purpose.

What Java version is required to compile Jenkins?

You must use JDK 21 or JDK 25. The build configuration in the root pom.xml enforces this via Maven toolchains and the enforcer plugin. Attempting to build with older versions results in immediate failure with a clear error message indicating the version requirement per the CONTRIBUTING.md guidelines.

Where is the compiled WAR file located after a successful build?

The jenkins.war file is located at war/target/jenkins.war relative to the repository root. This self-contained archive can be deployed to any servlet container or executed directly using java -jar war/target/jenkins.war after completing the Maven build process.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →