Skip to content

Commit 31b7fae

Browse files
committed
Set distribution checker target JDK compatibility to 11.
Signed-off-by: dblock <[email protected]>
1 parent 19b0967 commit 31b7fae

File tree

9 files changed

+26
-20
lines changed

9 files changed

+26
-20
lines changed

DEVELOPER_GUIDE.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,20 @@ Fork [opensearch-project/OpenSearch](https://github.com/opensearch-project/OpenS
6161

6262
#### JDK 11
6363

64-
OpenSearch builds using Java 11 at a minimum, using the Adoptium distribution. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`. This is configured in [buildSrc/build.gradle](buildSrc/build.gradle).
64+
OpenSearch builds using Java 11 at a minimum, using the Adoptium distribution. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`. This is configured in [buildSrc/build.gradle](buildSrc/build.gradle) and [distribution/tools/java-version-checker/build.gradle](distribution/tools/java-version-checker/build.gradle).
6565

6666
```
6767
allprojects {
68-
targetCompatibility = 11
69-
sourceCompatibility = 11
68+
targetCompatibility = JavaVersion.VERSION_11
69+
sourceCompatibility = JavaVersion.VERSION_11
7070
}
7171
```
7272

73+
```
74+
sourceCompatibility = JavaVersion.VERSION_11
75+
targetCompatibility = JavaVersion.VERSION_11
76+
```
77+
7378
Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).
7479

7580
#### JDK 14

buildSrc/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ if (project != rootProject) {
158158
apply plugin: 'opensearch.publish'
159159

160160
allprojects {
161-
targetCompatibility = 11
162-
sourceCompatibility = 11
161+
targetCompatibility = JavaVersion.VERSION_11
162+
sourceCompatibility = JavaVersion.VERSION_11
163163
}
164164

165165
// groovydoc succeeds, but has some weird internal exception...
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8
1+
11

client/rest/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
3333
apply plugin: 'opensearch.build'
3434
apply plugin: 'opensearch.publish'
3535

36-
targetCompatibility = JavaVersion.VERSION_1_8
37-
sourceCompatibility = JavaVersion.VERSION_1_8
36+
targetCompatibility = JavaVersion.VERSION_11
37+
sourceCompatibility = JavaVersion.VERSION_11
3838

3939
group = 'org.opensearch.client'
4040
archivesBaseName = 'opensearch-rest-client'

client/sniffer/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
apply plugin: 'opensearch.build'
3131
apply plugin: 'opensearch.publish'
3232

33-
targetCompatibility = JavaVersion.VERSION_1_8
34-
sourceCompatibility = JavaVersion.VERSION_1_8
33+
targetCompatibility = JavaVersion.VERSION_11
34+
sourceCompatibility = JavaVersion.VERSION_11
3535

3636
group = 'org.opensearch.client'
3737
archivesBaseName = 'opensearch-rest-client-sniffer'

client/test/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
*/
3030
apply plugin: 'opensearch.build'
3131

32-
targetCompatibility = JavaVersion.VERSION_1_8
33-
sourceCompatibility = JavaVersion.VERSION_1_8
32+
targetCompatibility = JavaVersion.VERSION_11
33+
sourceCompatibility = JavaVersion.VERSION_11
3434

3535
group = "${group}.client.test"
3636

distribution/tools/java-version-checker/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111

1212
apply plugin: 'opensearch.build'
1313

14-
sourceCompatibility = JavaVersion.VERSION_1_8
15-
targetCompatibility = JavaVersion.VERSION_1_8
14+
sourceCompatibility = JavaVersion.VERSION_11
15+
targetCompatibility = JavaVersion.VERSION_11
16+
1617
// targetting very old java versions enables a warning by default on newer JDK: disable it.
1718
compileJava.options.compilerArgs += '-Xlint:-options'
1819

libs/core/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ if (!isEclipse) {
5454
}
5555

5656
compileJava11Java {
57-
sourceCompatibility = 11
58-
targetCompatibility = 11
57+
sourceCompatibility = JavaVersion.VERSION_11
58+
targetCompatibility = JavaVersion.VERSION_11
5959
}
6060

6161
forbiddenApisJava11 {
6262
if (BuildParams.runtimeJavaVersion < JavaVersion.VERSION_11) {
63-
targetCompatibility = JavaVersion.VERSION_11.getMajorVersion()
63+
targetCompatibility = JavaVersion.VERSION_11
6464
}
6565
replaceSignatureFiles 'jdk-signatures'
6666
}

server/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ if (!isEclipse) {
6464
}
6565

6666
compileJava11Java {
67-
sourceCompatibility = 11
68-
targetCompatibility = 11
67+
sourceCompatibility = JavaVersion.VERSION_11
68+
targetCompatibility = JavaVersion.VERSION_11
6969
}
7070

7171
tasks.named('forbiddenApisJava11').configure {
7272
doFirst {
7373
if (BuildParams.runtimeJavaVersion < JavaVersion.VERSION_11) {
74-
targetCompatibility = JavaVersion.VERSION_11.getMajorVersion()
74+
targetCompatibility = JavaVersion.VERSION_11
7575
}
7676
}
7777
}

0 commit comments

Comments
 (0)