What Programming Language Is Jenkins Written In? Deep Dive into Java and Groovy
Jenkins is primarily written in Java, with extensive Groovy integration for its Pipeline DSL and plugin scripting, compiled using Maven and deployed as a jenkins.war artifact.
Jenkins, the open-source automation server hosted at jenkinsci/jenkins, is fundamentally a Java platform. All core components—including the web UI, REST API, plugin framework, and executable wrapper—are implemented in Java and compiled against Java 17 or later. While the runtime engine is Java-centric, Jenkins embeds a Groovy runtime to power its Pipeline-as-Code functionality and dynamic plugin extensions.
Java Core Architecture
Server Bootstrap and Entry Points
The Jenkins server boots through core/src/main/java/hudson/Main.java, which initializes the application lifecycle and servlet context. When launching via java -jar jenkins.war, execution begins in war/src/main/java/executable/Main.java, where the embedded Winstone servlet container is instantiated before delegating to the core hudson.Main class. This two-stage bootstrap ensures the web container is properly configured before loading the Jenkins core.
Build System and Version Requirements
The project leverages Apache Maven for compilation and dependency management, configured in the root pom.xml. The build explicitly declares Java 17 (or later) as the source and target language level, enforcing modern Java standards across the codebase. Maven modules organize the project into core/, war/, test/, and plugins/ directories, with the final artifact packaged as the monolithic jenkins.war file.
Plugin Framework
All plugins extend the base class defined in core/src/main/java/hudson/Plugin.java, establishing a Java-native extension point system. The plugin API exposes Java interfaces for build steps, SCM integrations, and UI contributions, ensuring type-safe integration with the core engine while maintaining backward compatibility across releases.
Groovy for Pipeline and Automation
Pipeline-as-Code (Jenkinsfile)
Jenkins Pipeline utilizes Groovy as its domain-specific language, enabling users to define CI/CD workflows in Jenkinsfile scripts. The Groovy runtime (groovy-all dependency) loads dynamically alongside the Java core, executing pipeline DSL within a sandboxed environment. This architecture allows iterative scripting without restarting the Jenkins controller, bridging static Java infrastructure with flexible automation logic.
Plugin Scripting Extensions
Beyond user-facing pipelines, built-in plugins embed Groovy scripts for DSL extensions and runtime configuration. This hybrid approach lets developers leverage Java’s performance for compute-intensive tasks while using Groovy’s metaprogramming capabilities for dynamic job generation and conditional workflow logic.
Key Source Files
core/src/main/java/hudson/Main.java– Server bootstrap class that initializes the Jenkins instance and plugin manager.war/src/main/java/executable/Main.java– Executable wrapper that configures the Winstone servlet container and starts the HTTP listener.core/src/main/java/hudson/Plugin.java– Abstract base class that all Jenkins plugins must extend.pom.xml– Maven build definition specifying Java 17, module structure, and thegroovy-allruntime dependency.test/src/test/java/– Comprehensive JUnit test suite covering core functionality and integration scenarios.
Code Examples
Minimal Java Plugin
// src/main/java/com/example/HelloWorldPlugin.java
package com.example;
import hudson.Extension;
import hudson.model.RootAction;
@Extension
public class HelloWorldPlugin implements RootAction {
@Override
public String getIconFileName() { return "symbol-jenkins.svg"; }
@Override
public String getDisplayName() { return "Hello World"; }
@Override
public String getUrlName() { return "hello-world"; }
public String doIndex() {
return "<h1>Hello, Jenkins!</h1>";
}
}
Groovy Jenkinsfile
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Compiling...'
sh 'mvn clean compile'
}
}
stage('Test') {
steps {
echo 'Running tests...'
sh 'mvn test'
}
}
}
}
Command Line Launch
# Starts the embedded servlet container via war/src/main/java/executable/Main.java
java -jar jenkins.war --httpPort=8080
Summary
- Java powers the Jenkins core, plugin framework, web UI, and executable wrapper, requiring Java 17 or later.
- Groovy enables Pipeline-as-Code and dynamic scripting through embedded runtime support.
- Maven manages the build lifecycle, compiling source from
core/src/main/java/and packaging thejenkins.warartifact. - Key entry points reside in
hudson.Main.java(core bootstrap) andexecutable.Main.java(servlet container launcher).
Frequently Asked Questions
Is Jenkins written purely in Java?
While the core engine, plugin API, and web interface are implemented in Java, Jenkins is not purely Java. The platform embeds a Groovy runtime to execute Pipeline scripts and supports plugin development in other JVM languages, though Java remains the primary implementation language for both core and plugins.
Why does Jenkins use Groovy for pipelines?
Groovy provides dynamic scripting capabilities and DSL-friendly syntax that static Java cannot offer at runtime. This allows users to define complex, conditional workflows in Jenkinsfile scripts without recompiling the Jenkins core, leveraging Groovy's metaprogramming while sandboxing execution for security.
What Java version is required to run Jenkins?
According to the pom.xml build configuration, Jenkins requires Java 17 or later as both the compilation source and runtime target. Earlier Java versions are not supported in current Jenkins releases due to dependencies on modern JDK APIs and security requirements.
Can I write Jenkins plugins in languages other than Java?
Yes, you can write plugins in any JVM-compatible language such as Kotlin or Scala, provided they compile to bytecode that interfaces with the Java-based plugin API defined in hudson.Plugin. However, the official documentation, tooling, and majority of the plugin ecosystem are optimized for Java development.
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 →