Jenkins Source Code Directories: Navigating the Core Repository Structure

The Jenkins repository is organized as a multi-module Maven project with eight primary directories—core, war, test, cli, websocket/spi, websocket/jetty12-ee9, coverage, and bom—that separate the build engine, web interface, test suites, and command-line tooling into distinct, buildable units.

The jenkinsci/jenkins repository on GitHub houses the entire Jenkins automation server as a structured Maven multi-module project. Understanding the Jenkins source code directories is essential for developers contributing to the project, debugging issues, or extending functionality through plugins. Each top-level directory declared in the parent pom.xml serves a specific architectural purpose, from the Java engine that orchestrates builds to the WAR packaging that delivers the web UI.

Core Module Structure

The parent pom.xml at the repository root defines the module list in lines 52-60, establishing the high-level organization of the codebase. These Maven modules include:

  • core – The Java engine implementing the job model, build execution, plugin loading, and REST API
  • war – The web application packaging HTML, CSS, JavaScript, and servlet container configuration
  • test – Comprehensive unit and integration test suites for core and UI components
  • cli – The command-line client implementation (jenkins-cli.jar)
  • websocket/spi – The WebSocket Service Provider Interface abstraction
  • websocket/jetty12-ee9 – The concrete Jetty-based WebSocket runtime implementation
  • coverage – JaCoCo configuration for aggregating code coverage reports
  • bom – The Bill-of-Materials pom centralizing dependency version constraints

Detailed Directory Breakdown

The core Directory

The core directory contains the heart of Jenkins. It implements the job model, build execution logic, plugin loading mechanism, and most of the REST API.

Key locations within this module:

  • src/main/java/jenkins/* – Core classes including Jenkins.java, Item.java, Run.java, and the plugin manager
  • src/main/resources/ – Localization bundles and default configuration files

The war Directory

The war module assembles the deployable web application. It bundles the UI, static resources, and the embedded Winstone servlet container into the final jenkins.war artifact.

Important paths include:

  • src/main/webapp/ – HTML pages, JavaScript, CSS, and static assets
  • src/main/java/hudson/* – Legacy servlet code bridging core functionality with the web layer
  • src/main/webapp/WEB-INF/web.xml – Servlet container configuration

The test Directory

This module provides the comprehensive test harness for validating core and UI components. It contains JUnit tests for security, plugin interactions, and integration scenarios.

Key locations:

  • src/test/java/ – Unit and integration test classes
  • src/test/resources/ – Test data and configuration fixtures

The cli Directory

The cli module implements the command-line client that allows scripting and remote management of Jenkins instances. The entry point is located at src/main/java/jenkins/cli/CLI.java.

WebSocket Implementation (websocket/*)

The WebSocket modules enable real-time UI updates:

  • websocket/spi – Abstract contract for WebSocket providers
  • websocket/jetty12-ee9 – Concrete Jetty 12 implementation for the runtime

Support Modules (coverage and bom)

  • coverage – Aggregates JaCoCo coverage reports across all modules
  • bom – Centralizes version constraints for transitive dependencies to ensure consistency

Building and Running from Source

To work with these directories effectively, clone the repository and build specific modules or the entire project.

Clone and build all modules:

git clone https://github.com/jenkinsci/jenkins.git
cd jenkins
mvn clean install -DskipTests

The parent pom.xml automatically resolves dependencies between modules, building them in the correct order.

Run the built WAR locally:

java -jar war/target/jenkins.war

This launches the embedded Winstone servlet container with the web UI.

Use the CLI client after building:

java -jar cli/target/jenkins-cli.jar -s http://localhost:8080 help

Key Navigation Files

Understanding these specific files accelerates codebase navigation:

Summary

  • The Jenkins repository uses a Maven multi-module structure with eight primary directories defined in the parent pom.xml
  • core contains the server-side engine and plugin API, while war packages the web interface
  • test houses comprehensive validation suites, and cli provides remote scripting capabilities
  • websocket/* modules abstract real-time communication infrastructure
  • coverage and bom support build quality and dependency management
  • Reference files like Jenkins.java and web.xml serve as anchors for navigating the codebase

Frequently Asked Questions

What is the difference between the core and war directories in Jenkins?

The core directory contains the Java engine that implements Jenkins' business logic, job scheduling, and plugin system. The war directory packages this core alongside the web interface (HTML, CSS, JavaScript) and servlet configuration into a deployable WAR file. While core functions as a library module, war produces the executable artifact that runs in the servlet container.

Where are the main Java source files located in the Jenkins repository?

The primary Java source files reside in core/src/main/java/jenkins/, which contains central classes like Jenkins.java, Item.java, and Run.java. Legacy servlet bridge code exists in war/src/main/java/hudson/, and the CLI implementation is located in cli/src/main/java/jenkins/cli/.

How do I build only specific modules instead of the entire Jenkins project?

Use Maven's -pl (projects list) flag to target specific directories. For example, mvn clean install -pl core,war -am builds only the core and war modules along with their required dependencies. The -am flag ensures Maven also builds any modules that the selected ones depend upon.

What is the purpose of the bom directory in the Jenkins source code?

The bom (Bill-of-Materials) directory contains a Maven pom that defines version constraints for all transitive dependencies used across the Jenkins project. This ensures consistent dependency versions across modules and prevents version conflicts when building the project.

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 →