# Where Is the Jenkins Core Code Located?

> Discover the exact location of the Jenkins core code within the jenkinsci/jenkins repository. Find the main application entry point in Jenkins.java.

- Repository: [Jenkins/jenkins](https://github.com/jenkinsci/jenkins)
- Tags: internals
- Published: 2026-08-01

---

**The Jenkins core code resides in the `core` Maven module under `core/src/main/java/`, with the main application entry point located at [`jenkins/model/Jenkins.java`](https://github.com/jenkinsci/jenkins/blob/main/jenkins/model/Jenkins.java).**

The heart of the Jenkins automation server lives in the `jenkinsci/jenkins` repository, specifically within the **core module** that contains the Java implementation of the engine, its data model, and essential utilities. Understanding the layout of the Jenkins core code is essential for developers contributing to the platform or building advanced plugins that interact with internal APIs.

## Maven Module Structure

The Jenkins project follows a multi-module Maven architecture. The root [`pom.xml`](https://github.com/jenkinsci/jenkins/blob/main/pom.xml) declares the core module, which is built as a separate artifact that other modules—such as `war`, `cli`, and plugins—depend upon.

In the root [`pom.xml`](https://github.com/jenkinsci/jenkins/blob/main/pom.xml), the core module is listed among the project modules. The [`core/pom.xml`](https://github.com/jenkinsci/jenkins/blob/main/core/pom.xml) defines the module's specific dependencies, packaging configuration, and build plugins required to compile the Jenkins engine.

## Core Source Directory Layout

All core-related source files live under the path:

```

core/src/main/java/

```

This directory is organized into logical sub-packages that group related functionality:

- **`jenkins/`** – Contains modern Jenkins-specific classes, including the main `Jenkins` singleton and new API extensions.
- **`hudson/`** – Houses the original Hudson model classes, including job definitions and project types.
- **`hudson.util/`** – Provides utility classes for XML serialization, I/O operations, and security helpers.

## Key Classes and Entry Points

### The Jenkins Singleton ([`jenkins/model/Jenkins.java`](https://github.com/jenkinsci/jenkins/blob/main/jenkins/model/Jenkins.java))

The class `jenkins.model.Jenkins` serves as the primary entry point for the entire application. Located at [`core/src/main/java/jenkins/model/Jenkins.java`](https://github.com/jenkinsci/jenkins/blob/main/core/src/main/java/jenkins/model/Jenkins.java), this class maintains the global singleton instance, handles bootstrapping logic when the servlet container starts, and exposes most of the public API for accessing configuration, plugins, and the job model.

Key methods include `Jenkins.getInstanceOrNull()` and `Jenkins.get()`, which retrieve the running Jenkins instance, and `getPluginManager()`, which provides access to the installed plugin ecosystem.

### Project and Job Model (`hudson/model/`)

The foundational data model for CI/CD workflows resides in the `hudson.model` package:

- **[`AbstractProject.java`](https://github.com/jenkinsci/jenkins/blob/main/AbstractProject.java)** – Located at [`core/src/main/java/hudson/model/AbstractProject.java`](https://github.com/jenkinsci/jenkins/blob/main/core/src/main/java/hudson/model/AbstractProject.java), this is the base class for all Jenkins project types, including freestyle projects and pipelines.
- **[`Job.java`](https://github.com/jenkinsci/jenkins/blob/main/Job.java)** – Found at [`core/src/main/java/hudson/model/Job.java`](https://github.com/jenkinsci/jenkins/blob/main/core/src/main/java/hudson/model/Job.java), this interface defines the contract for all runnable items in Jenkins, providing methods for build scheduling and history management.

### Core Utilities (`hudson/util/`)

Supporting infrastructure code includes:

- **[`XStream2.java`](https://github.com/jenkinsci/jenkins/blob/main/XStream2.java)** – At [`core/src/main/java/hudson/util/XStream2.java`](https://github.com/jenkinsci/jenkins/blob/main/core/src/main/java/hudson/util/XStream2.java), this class provides a secure wrapper around the XStream library for XML serialization of Jenkins configuration and build data.
- **[`Archiver.java`](https://github.com/jenkinsci/jenkins/blob/main/Archiver.java)** – Located in [`core/src/main/java/hudson/util/io/Archiver.java`](https://github.com/jenkinsci/jenkins/blob/main/core/src/main/java/hudson/util/io/Archiver.java), this abstract base class handles archive operations for artifacts, supporting formats like ZIP and TAR.

## Programmatically Accessing Jenkins Core

When writing extensions or interacting with Jenkins programmatically, you access these core classes directly.

To obtain the Jenkins instance and check the version:

```java
import jenkins.model.Jenkins;

public class StartJenkins {
    public static void main(String[] args) throws Exception {
        // Retrieve the Jenkins singleton (normally bootstrapped by the servlet container)
        Jenkins jenkins = Jenkins.getInstanceOrNull();
        if (jenkins == null) {
            jenkins = Jenkins.getInstance(); // Initializes a new instance if needed
        }
        
        // Access core services such as the plugin manager
        jenkins.getPluginManager().getPlugins();
        System.out.println("Jenkins version: " + jenkins.getVersion());
    }
}

```

To iterate over all jobs using the core model:

```java
import jenkins.model.Jenkins;
import hudson.model.Job;

public class ListJobs {
    public static void main(String[] args) {
        Jenkins j = Jenkins.get();
        for (Job<?, ?> job : j.getAllItems(Job.class)) {
            System.out.println(job.getFullName());
        }
    }
}

```

## Summary

- The Jenkins core code is located in the **`core`** Maven module at `core/src/main/java/`.
- The main entry point is the **`Jenkins`** class in the `jenkins.model` package.
- Key model classes like **`AbstractProject`** and **`Job`** reside in the `hudson.model` package.
- Utility classes for serialization and I/O are found in **`hudson.util`** and **`hudson.util.io`**.
- The core module is declared in the root [`pom.xml`](https://github.com/jenkinsci/jenkins/blob/main/pom.xml) and built as an artifact that the `war`, `cli`, and plugin modules depend upon.

## Frequently Asked Questions

### What is the main entry point class in Jenkins core?

The main entry point is the **`Jenkins`** class located at [`core/src/main/java/jenkins/model/Jenkins.java`](https://github.com/jenkinsci/jenkins/blob/main/core/src/main/java/jenkins/model/Jenkins.java). This class holds the global singleton instance, manages the bootstrapping process when the servlet container initializes, and provides the primary API for accessing the job model, plugin manager, and system configuration.

### How is the Jenkins core module organized in the repository?

The core module follows standard Maven directory conventions with source code under **`core/src/main/java/`**. It is organized into packages such as `jenkins.model` for the application singleton, `hudson.model` for job and project definitions, and `hudson.util` for supporting utilities like XML serialization and file archiving.

### What build tool does Jenkins use for its core module?

Jenkins uses **Apache Maven** to build the core module. The module is defined in [`core/pom.xml`](https://github.com/jenkinsci/jenkins/blob/main/core/pom.xml) and referenced in the root [`pom.xml`](https://github.com/jenkinsci/jenkins/blob/main/pom.xml), allowing it to be compiled as a standalone JAR artifact that other modules and plugins can declare as a dependency.

### Can I use Jenkins core classes in my plugin development?

Yes, plugins depend on the Jenkins core module via the Jenkins Plugin Parent POM. Classes such as `Jenkins`, `Job`, and `AbstractProject` are part of the public API available to plugin developers, allowing you to access the running instance, iterate over jobs, and extend project types using the same core classes found in `core/src/main/java/`.