Building Jetty

Jetty’s uses Apache Maven for builds. To successfully build the project, you will also need a recent version of the Java Development Kit (JDK).

Maven and JDK requirements

Here are the minimum Maven and JDK version build requirements for each actively maintained branch.

Build versioning requirements by branch

|== | Branch | Maven Version | Minimum JDK | Recommended JDK

| jetty-12.0.x | Maven 3.9.2+ | OpenJDK 17+ | OpenJDK 19 | jetty-11.0.x | Maven 3.8.6+ | OpenJDK 11+ | OpenJDK 17 | jetty-10.0.x | Maven 3.8.6+ | OpenJDK 11+ | OpenJDK 17 |==

To build the Jetty documentation, OpenJDK 19+ is required due to the use of the virtual thread APIs.

Running a fast build

To get started with Jetty as quickly as possible, navigate to your local copy of the Jetty repo and run:

mvn -Pfast clean install

The -Pfast flag tells Maven to bypass running tests and other checks.

Running a full build

To build Jetty and automatically run all tests, run:

mvn clean install

The full build takes substantial time and memory, as it runs hundreds of test cases — many of which spin up embedded instances of Jetty itself.

The build also runs stress tests that may require you (depending on your hardware or operating system) to set you file descriptor limit to a value greater than 2048. You can view or set your file descriptor limit by running:

$ ulimit -n [new_value]
Flagging flaky tests
== Not all test cases are as timing independent as they should be, which can result in intermittent test failures. You can help us track these flaky tests by opening an issue when you come across one. ==

Maven Build Cache

Per default, the build is using the Maven Build Cache extension this means you will use your local build cache, To disable it you can use the property

$ mvn clean install -Dmaven.build.cache.enabled=false

Executing tests in parallel

Jetty uses Junit5’s parallel execution to run test cases in parallel. This behavior is configurable via flags passed to Maven, like so:

mvn install -Djunit.jupiter.execution.parallel.enabled=false

Here are the available configuration flags:

-Djunit.jupiter.execution.parallel.enabled=[BOOLEAN]

Disables parallel execution of tests.

-Djunit.jupiter.execution.parallel.config.fixed.parallelism=[NUMBER]

Configures the number of tests to be executed in parallel.

== Certain tests cannot be run in parallel because they access or modify static fields, and are tagged in the codebase with this annotation:
@Isolated("Access static field of Configurations")

Maven will run these tests in isolation even when parallel execution is explicitly enabled. ==

Optional build tools

  • Graphviz: used by Asciidoctor in the jetty-documentation module to produce various PlantUML graphs.

  • Docker: used to run some integration tests for testing third party integrations.

Build artifacts

Once the build is complete, you can find the built Jetty Maven artifacts in your Maven local repository, along with the following locations of note:

|== | Branch(es) | Location | Description

| all | jetty-home/target/jetty-home-<ver>.tar.gz | The Jetty Home distribution | jetty-12.0.x | jetty-ee10/jetty-ee10-runner/target/jetty-ee10-runner-<ver>.jar | The Jetty Runner distribution for EE10/Servlet 6 (jakarta.servlet) webapps | jetty-12.0.x | jetty-ee9/jetty-ee9-runner/target/jetty-ee9-runner-<ver>.jar | The Jetty Runner distribution for EE9/Servlet 5 (jakarta.servlet) webapps | jetty-12.0.x | jetty-ee8/jetty-ee8-runner/target/jetty-ee8-runner-<ver>.jar | The Jetty Runner distribution for EE8/Servlet 4 (javax.servlet) webapps | jetty-11.0.x | jetty-runner/target/jetty-runner-<ver>.jar | The Jetty Runner distribution for EE9/Servlet 5 (jakarta.servlet) webapps | jetty-10.0.x | jetty-runner/target/jetty-runner-<ver>.jar | The Jetty Runner distribution for EE8/Servlet 4 (javax.servlet) webapps |==