Skip to content

Commit f069cf9

Browse files
authored
Update contributing with Java 15 requirement (#69829)
The build has been updated to require JDK15 for compilation but the contributing docs were out of date. This commit updates the docs to have the correct JDK requirement. Backport of #69824
1 parent 53f8cd5 commit f069cf9

File tree

1 file changed

+82
-9
lines changed

1 file changed

+82
-9
lines changed

CONTRIBUTING.md

Lines changed: 82 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,25 +98,25 @@ Contributing to the Elasticsearch codebase
9898

9999
**Repository:** [https://github.com/elastic/elasticsearch](https://github.com/elastic/elasticsearch)
100100

101-
JDK 14 is required to build Elasticsearch. You must have a JDK 14 installation
101+
JDK 15 is required to build Elasticsearch. You must have a JDK 15 installation
102102
with the environment variable `JAVA_HOME` referencing the path to Java home for
103-
your JDK 14 installation. By default, tests use the same runtime as `JAVA_HOME`.
103+
your JDK 15 installation. By default, tests use the same runtime as `JAVA_HOME`.
104104
However, since Elasticsearch supports JDK 8, the build supports compiling with
105-
JDK 14 and testing on a JDK 8 runtime; to do this, set `RUNTIME_JAVA_HOME`
105+
JDK 15 and testing on a JDK 8 runtime; to do this, set `RUNTIME_JAVA_HOME`
106106
pointing to the Java home of a JDK 8 installation. Note that this mechanism can
107107
be used to test against other JDKs as well, this is not only limited to JDK 8.
108108

109109
> Note: It is also required to have `JAVA8_HOME`, `JAVA9_HOME`, `JAVA10_HOME`
110-
and `JAVA11_HOME`, and `JAVA12_HOME` available so that the tests can pass.
110+
and `JAVA11_HOME`, `JAVA12_HOME`, `JAVA13_HOME`, `JAVA14_HOME`, and `JAVA15_HOME`
111+
available so that the tests can pass.
111112

112113
Elasticsearch uses the Gradle wrapper for its build. You can execute Gradle
113114
using the wrapper via the `gradlew` script on Unix systems or `gradlew.bat`
114115
script on Windows in the root of the repository. The examples below show the
115116
usage on Unix.
116117

117-
We support development in IntelliJ versions IntelliJ 2019.2 and
118-
onwards. We would like to support Eclipse, but few of us use it and has fallen
119-
into [disrepair][eclipse].
118+
We support development in IntelliJ versions IntelliJ 2020.1 and
119+
onwards and Eclipse 2020-3 and onwards.
120120

121121
[Docker](https://docs.docker.com/install/) is required for building some Elasticsearch artifacts and executing certain test suites. You can run Elasticsearch without building all the artifacts with:
122122

@@ -138,9 +138,10 @@ and then run `curl` in another window like this:
138138

139139
### Importing the project into IntelliJ IDEA
140140

141-
Elasticsearch builds using Java 14. When importing into IntelliJ you will need
141+
The minimum IntelliJ IDEA version required to import the Elasticsearch project is 2020.1
142+
Elasticsearch builds using Java 15. When importing into IntelliJ you will need
142143
to define an appropriate SDK. The convention is that **this SDK should be named
143-
"14"** so that the project import will detect it automatically. For more details
144+
"15"** so that the project import will detect it automatically. For more details
144145
on defining an SDK in IntelliJ please refer to [their documentation](https://www.jetbrains.com/help/idea/sdk.html#define-sdk).
145146
SDK definitions are global, so you can add the JDK from any project, or after
146147
project import. Importing with a missing JDK will still work, IntelliJ will
@@ -197,6 +198,78 @@ Note that only some sub-projects in the Elasticsearch project are currently
197198
fully-formatted. You can see a list of project that **are not**
198199
automatically formatted in [gradle/formatting.gradle](gradle/formatting.gradle).
199200

201+
### Importing the project into Eclipse
202+
203+
Elasticsearch builds using Gradle and Java 15. When importing into Eclipse you
204+
will either need to use an appropriate JDK to run Eclipse itself (e.g. by
205+
specifying the VM in [eclipse.ini](https://wiki.eclipse.org/Eclipse.ini) or by
206+
defining the JDK Gradle uses by setting **Preferences** > **Gradle** >
207+
**Advanced Options** > **Java home** to an appropriate version.
208+
209+
IMPORTANT: If you have previously imported the project by running `./gradlew eclipse`
210+
then you must build an entirely new workspace and `git clean -xdf` to
211+
blow away *everything* that the gradle eclipse plugin made.
212+
213+
- Select **File > Import...**
214+
- Select **Existing Gradle Project**
215+
- Select **Next** then **Next** again
216+
- Set the **Project root directory** to the root of your elasticsearch clone
217+
- Click **Finish**
218+
219+
This will spin for a long, long time but you'll see many errors about circular
220+
dependencies. Fix them:
221+
222+
- Select **Window > Preferences**
223+
- Select **Java > Compiler > Building**
224+
- Look under **Build Path Problems**
225+
- Set **Circular dependencies** to **Warning**
226+
- Apply that and let the build spin away for a while
227+
228+
Next you'll want to import our auto-formatter:
229+
230+
- Select **Window > Preferences**
231+
- Select **Java > Code Style > Formatter**
232+
- Click **Import**
233+
- Import the file at **buildSrc/formatterConfig.xml**
234+
- Make sure it is the **Active profile**
235+
236+
Finally, set up import order:
237+
238+
- Select **Window > Preferences**
239+
- Select **Java > Code Style > Organize Imports**
240+
- Click **Import...**
241+
- Import the file at **buildSrc/elastic.importorder**
242+
- Set the **Number of imports needed for `.*`** to ***9999***
243+
- Set the **Number of static imports needed for `.*`** to ***9999*** as well
244+
- Apply that
245+
246+
IMPORTANT: There is an option in **Gradle** for **Automatic Project Synchronization**.
247+
As convenient as it'd be for the projects to always be perfect this
248+
tends to add many many seconds to every branch change. Instead, you
249+
should manually right click on a project and
250+
**Gradle > Refresh Gradle Project** if the configuration is out of
251+
date.
252+
253+
As we add more subprojects you might have to re-import the gradle project (the
254+
first step) again. There is no need to blow away the existing projects before
255+
doing that.
256+
257+
### REST Endpoint Conventions
258+
259+
Elasticsearch typically uses singular nouns rather than plurals in URLs.
260+
For example:
261+
262+
/_ingest/pipeline
263+
/_ingest/pipeline/{id}
264+
265+
but not:
266+
267+
/_ingest/pipelines
268+
/_ingest/pipelines/{id}
269+
270+
You may find counterexamples, but new endpoints should use the singular
271+
form.
272+
200273
### Java Language Formatting Guidelines
201274

202275
Java files in the Elasticsearch codebase are formatted with the Eclipse JDT

0 commit comments

Comments
 (0)