Skip to content

Commit

Permalink
Set release in maven-compiler-plugin configuration and enforce JDK 11…
Browse files Browse the repository at this point in the history
…+ 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.
  • Loading branch information
lhotari committed Feb 8, 2021
1 parent efb2089 commit 75c462e
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-build-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ jobs:
!~/.m2/.gradle-enterprise
key: ${{ runner.os }}-maven-dependencies-${{ hashFiles('**/pom.xml') }}

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: build package
run: mvn clean install -DskipTests
4 changes: 2 additions & 2 deletions .github/workflows/ci-cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-backwards-compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
if: steps.docs.outputs.changed_only == 'no'
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-function-state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-messaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-process.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-sql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-standalone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-thread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-tiered-filesystem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-tiered-jcloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-transaction.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 1.8
- name: Set up JDK 11
if: steps.docs.outputs.changed_only == 'no'
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

# license check fails with 3.6.2 so we have to downgrade
- name: Set up Maven
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-shade-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ jobs:
with:
args: site2 deployment .asf.yaml .ci ct.yaml

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8
java-version: 11

- name: clean disk
if: steps.docs.outputs.changed_only == 'no'
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ components in the Pulsar ecosystem, including connectors, adapters, and other la
## Build Pulsar

Requirements:
* Java 8 JDK (for building Pulsar)
* 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).
* Java 11 JDK (for building Pulsar)
* Maven 3.6.1+

Compile and install:
Expand Down
4 changes: 2 additions & 2 deletions buildtools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>8</release>
</configuration>
</plugin>
</plugins>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1065,8 +1065,7 @@ flexible messaging model and an intuitive client API.</description>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>8</release>
<encoding>UTF-8</encoding>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
Expand Down Expand Up @@ -1332,16 +1331,17 @@ flexible messaging model and an intuitive client API.</description>
<executions>
<execution>
<id>enforce-maven</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[1.8.0,)</version>
<version>[11,)</version>
</requireJavaVersion>
<requireMavenVersion>
<version>[3.3.9,)</version>
<version>[3.6.1,)</version>
</requireMavenVersion>
</rules>
</configuration>
Expand Down

0 comments on commit 75c462e

Please sign in to comment.