Skip to content

Commit

Permalink
Add the contribution guide from Jetty 12
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcc0nn3ll committed May 17, 2024
1 parent 3423d58 commit b6786e2
Show file tree
Hide file tree
Showing 10 changed files with 794 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion contribution-guide/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
* More pages to come
//
// ========================================================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//

.xref:index.adoc[]
* xref:eca/index.adoc[]
* xref:source/index.adoc[]
* xref:build/index.adoc[]
* xref:standards/index.adoc[]
* xref:documentation/index.adoc[]
* xref:patches/index.adoc[]
* xref:security/index.adoc[]
137 changes: 137 additions & 0 deletions contribution-guide/modules/ROOT/pages/build/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
//
// ====================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ====================================
//

[[cg-build]]
= Building Jetty

Jetty's uses http://maven.apache.org/[Apache Maven] for builds.
To successfully build the project, you will also need a recent version of the https://www.oracle.com/java/technologies/downloads/[Java Development Kit (JDK)].

[[cg-build-requirements]]
== 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.

[[cg-build-fast]]
== Running a fast build

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

[source, shell]
----
mvn -Pfast clean install
----

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

[[cg-build-full]]
== Running a full build

To build Jetty and automatically run all tests, run:

[source, shell]
----
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:

[source, shell]
----
$ ulimit -n [new_value]
----

[TIP]
.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 https://github.com/eclipse/jetty.project/issues[issue] when you come across one.
==

[[cg-build-cache]]
== Maven Build Cache

Per default, the build is using the https://maven.apache.org/extensions/maven-build-cache-extension[Maven Build Cache extension]
this means you will use your local build cache, To disable it you can use the property

[source, shell]
----
$ mvn clean install -Dmaven.build.cache.enabled=false
----


[[cg-build-parallel]]
== Executing tests in parallel

Jetty uses https://junit.org/junit5/docs/current/user-guide/#writing-tests-parallel-execution[Junit5's parallel execution] to run test cases in parallel.
This behavior is configurable via flags passed to Maven, like so:

[source, shell]
----
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.

[NOTE]
==
Certain tests cannot be run in parallel because they access or modify `static` fields, and are tagged in the codebase with this annotation:

[source, java]
----
@Isolated("Access static field of Configurations")
----

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

[[cg-build-optional-tools]]
== Optional build tools

* https://graphviz.org/[Graphviz]: used by Asciidoctor in the `jetty-documentation` module to produce various link:https://plantuml.com/[PlantUML] graphs.
* https://www.docker.com/[Docker]: used to run some integration tests for testing third party integrations.

[[cg-build-artifacts]]
== 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:

[cols="1a,2a,2a"]
|==
| 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
|==
Loading

0 comments on commit b6786e2

Please sign in to comment.