Skip to content

Commit 75c462e

Browse files
committed
Set release in maven-compiler-plugin configuration and enforce JDK 11+ for compiling
Fixes apache#8445 - Sets release in maven-compiler-plugin configuration this results in passing "--release 8" flag to the javac compiler - ensures that correct methods are chosen in compilation. For example, without passing the flag, incorrect java.nio.ByteBuffer methods will be chosen in the case that compilation is performed on Java 9+ and runtime uses Java 8. This results in NoSuchMethodErrors at runtime.
1 parent efb2089 commit 75c462e

19 files changed

+39
-40
lines changed

.github/workflows/ci-build-macos.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ jobs:
5454
!~/.m2/.gradle-enterprise
5555
key: ${{ runner.os }}-maven-dependencies-${{ hashFiles('**/pom.xml') }}
5656

57-
- name: Set up JDK 1.8
57+
- name: Set up JDK 11
5858
uses: actions/setup-java@v1
5959
with:
60-
java-version: 1.8
60+
java-version: 11
6161

6262
- name: build package
6363
run: mvn clean install -DskipTests

.github/workflows/ci-cpp.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ jobs:
5858
restore-keys: |
5959
${{ runner.os }}-maven-
6060
61-
- name: Set up JDK 1.8
61+
- name: Set up JDK 11
6262
uses: actions/setup-java@v1
6363
if: steps.docs.outputs.changed_only == 'no'
6464
with:
65-
java-version: 1.8
65+
java-version: 11
6666

6767
- name: clean disk
6868
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-backwards-compatibility.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ jobs:
5757
with:
5858
args: site2 deployment .asf.yaml .ci ct.yaml
5959

60-
- name: Set up JDK 1.8
60+
- name: Set up JDK 11
6161
if: steps.docs.outputs.changed_only == 'no'
6262
uses: actions/setup-java@v1
6363
with:
64-
java-version: 1.8
64+
java-version: 11
6565

6666
- name: clean disk
6767
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-cli.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ jobs:
5757
with:
5858
args: site2 deployment .asf.yaml .ci ct.yaml
5959

60-
- name: Set up JDK 1.8
60+
- name: Set up JDK 11
6161
uses: actions/setup-java@v1
6262
if: steps.docs.outputs.changed_only == 'no'
6363
with:
64-
java-version: 1.8
64+
java-version: 11
6565

6666
- name: clean disk
6767
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-function-state.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ jobs:
5757
with:
5858
args: site2 deployment .asf.yaml .ci ct.yaml
5959

60-
- name: Set up JDK 1.8
60+
- name: Set up JDK 11
6161
uses: actions/setup-java@v1
6262
if: steps.docs.outputs.changed_only == 'no'
6363
with:
64-
java-version: 1.8
64+
java-version: 11
6565

6666
- name: clean disk
6767
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-messaging.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ jobs:
5757
with:
5858
args: site2 deployment .asf.yaml .ci ct.yaml
5959

60-
- name: Set up JDK 1.8
60+
- name: Set up JDK 11
6161
uses: actions/setup-java@v1
6262
if: steps.docs.outputs.changed_only == 'no'
6363
with:
64-
java-version: 1.8
64+
java-version: 11
6565

6666
- name: clean disk
6767
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-process.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
with:
5757
args: site2 deployment .asf.yaml .ci ct.yaml
5858

59-
- name: Set up JDK 1.8
59+
- name: Set up JDK 11
6060
uses: actions/setup-java@v1
6161
if: steps.docs.outputs.changed_only == 'no'
6262
with:
63-
java-version: 1.8
63+
java-version: 11
6464

6565
- name: clean disk
6666
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-schema.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
with:
5757
args: site2 deployment .asf.yaml .ci ct.yaml
5858

59-
- name: Set up JDK 1.8
59+
- name: Set up JDK 11
6060
uses: actions/setup-java@v1
6161
if: steps.docs.outputs.changed_only == 'no'
6262
with:
63-
java-version: 1.8
63+
java-version: 11
6464

6565
- name: clean disk
6666
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-sql.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
with:
5757
args: site2 deployment .asf.yaml .ci ct.yaml
5858

59-
- name: Set up JDK 1.8
59+
- name: Set up JDK 11
6060
uses: actions/setup-java@v1
6161
if: steps.docs.outputs.changed_only == 'no'
6262
with:
63-
java-version: 1.8
63+
java-version: 11
6464

6565
- name: clean disk
6666
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-standalone.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
with:
5757
args: site2 deployment .asf.yaml .ci ct.yaml
5858

59-
- name: Set up JDK 1.8
59+
- name: Set up JDK 11
6060
uses: actions/setup-java@v1
6161
if: steps.docs.outputs.changed_only == 'no'
6262
with:
63-
java-version: 1.8
63+
java-version: 11
6464

6565
- name: clean disk
6666
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-thread.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
with:
5757
args: site2 deployment .asf.yaml .ci ct.yaml
5858

59-
- name: Set up JDK 1.8
59+
- name: Set up JDK 11
6060
uses: actions/setup-java@v1
6161
if: steps.docs.outputs.changed_only == 'no'
6262
with:
63-
java-version: 1.8
63+
java-version: 11
6464

6565
- name: clean disk
6666
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-tiered-filesystem.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
with:
5757
args: site2 deployment .asf.yaml .ci ct.yaml
5858

59-
- name: Set up JDK 1.8
59+
- name: Set up JDK 11
6060
uses: actions/setup-java@v1
6161
if: steps.docs.outputs.changed_only == 'no'
6262
with:
63-
java-version: 1.8
63+
java-version: 11
6464

6565
- name: clean disk
6666
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-tiered-jcloud.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
with:
5757
args: site2 deployment .asf.yaml .ci ct.yaml
5858

59-
- name: Set up JDK 1.8
59+
- name: Set up JDK 11
6060
uses: actions/setup-java@v1
6161
if: steps.docs.outputs.changed_only == 'no'
6262
with:
63-
java-version: 1.8
63+
java-version: 11
6464

6565
- name: clean disk
6666
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-integration-transaction.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
with:
5757
args: site2 deployment .asf.yaml .ci ct.yaml
5858

59-
- name: Set up JDK 1.8
59+
- name: Set up JDK 11
6060
uses: actions/setup-java@v1
6161
if: steps.docs.outputs.changed_only == 'no'
6262
with:
63-
java-version: 1.8
63+
java-version: 11
6464

6565
- name: clean disk
6666
if: steps.docs.outputs.changed_only == 'no'

.github/workflows/ci-license.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ jobs:
5858
restore-keys: |
5959
${{ runner.os }}-maven-
6060
61-
- name: Set up JDK 1.8
61+
- name: Set up JDK 11
6262
if: steps.docs.outputs.changed_only == 'no'
6363
uses: actions/setup-java@v1
6464
with:
65-
java-version: 1.8
65+
java-version: 11
6666

6767
# license check fails with 3.6.2 so we have to downgrade
6868
- name: Set up Maven

.github/workflows/ci-shade-test.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ jobs:
5757
with:
5858
args: site2 deployment .asf.yaml .ci ct.yaml
5959

60-
- name: Set up JDK 1.8
60+
- name: Set up JDK 11
6161
uses: actions/setup-java@v1
6262
if: steps.docs.outputs.changed_only == 'no'
6363
with:
64-
java-version: 1.8
64+
java-version: 11
6565

6666
- name: clean disk
6767
if: steps.docs.outputs.changed_only == 'no'

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ components in the Pulsar ecosystem, including connectors, adapters, and other la
8686
## Build Pulsar
8787

8888
Requirements:
89-
* Java 8 JDK (for building Pulsar)
90-
* When building Pulsar on a higher version (higher than Java 8), the resulting artifacts are not compatible with Java 8 runtime because of some issues, such as [issue 8445](https://github.com/apache/pulsar/issues/8445).
89+
* Java 11 JDK (for building Pulsar)
9190
* Maven 3.6.1+
9291

9392
Compile and install:

buildtools/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
</plugin>
7777
<plugin>
7878
<artifactId>maven-compiler-plugin</artifactId>
79+
<version>3.8.1</version>
7980
<configuration>
80-
<source>1.8</source>
81-
<target>1.8</target>
81+
<release>8</release>
8282
</configuration>
8383
</plugin>
8484
</plugins>

pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1065,8 +1065,7 @@ flexible messaging model and an intuitive client API.</description>
10651065
<plugin>
10661066
<artifactId>maven-compiler-plugin</artifactId>
10671067
<configuration>
1068-
<source>1.8</source>
1069-
<target>1.8</target>
1068+
<release>8</release>
10701069
<encoding>UTF-8</encoding>
10711070
<showDeprecation>true</showDeprecation>
10721071
<showWarnings>true</showWarnings>
@@ -1332,16 +1331,17 @@ flexible messaging model and an intuitive client API.</description>
13321331
<executions>
13331332
<execution>
13341333
<id>enforce-maven</id>
1334+
<phase>validate</phase>
13351335
<goals>
13361336
<goal>enforce</goal>
13371337
</goals>
13381338
<configuration>
13391339
<rules>
13401340
<requireJavaVersion>
1341-
<version>[1.8.0,)</version>
1341+
<version>[11,)</version>
13421342
</requireJavaVersion>
13431343
<requireMavenVersion>
1344-
<version>[3.3.9,)</version>
1344+
<version>[3.6.1,)</version>
13451345
</requireMavenVersion>
13461346
</rules>
13471347
</configuration>

0 commit comments

Comments
 (0)