Skip to content

Commit

Permalink
refactor(java11) - convert most modules to java 11 (#5836)
Browse files Browse the repository at this point in the history
Co-authored-by: Shirshanka Das <[email protected]>
  • Loading branch information
leifker and shirshanka authored Sep 25, 2022
1 parent 325b959 commit 203a6ff
Show file tree
Hide file tree
Showing 48 changed files with 170 additions and 132 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- uses: actions/setup-python@v2
with:
python-version: "3.7"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-datahub-jars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- uses: actions/setup-python@v2
with:
python-version: "3.7"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-unified.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,10 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- uses: actions/setup-python@v2
with:
python-version: "3.7"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- uses: actions/setup-python@v2
with:
python-version: "3.10"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/metadata-io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- uses: actions/setup-python@v2
with:
python-version: "3.7"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-datahub-jars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- uses: actions/setup-python@v2
with:
python-version: "3.7"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spark-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- uses: actions/setup-python@v2
with:
python-version: "3.7"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ MANIFEST
**/build
/config
*/i18n
/out
out/

# Mac OS
**/.DS_Store
Expand Down
43 changes: 9 additions & 34 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ buildscript {
classpath 'com.github.node-gradle:gradle-node-plugin:2.2.4'
classpath 'com.commercehub.gradle.plugin:gradle-avro-plugin:0.8.1'
classpath 'org.springframework.boot:spring-boot-gradle-plugin:' + springBootVersion
classpath('com.github.jengelman.gradle.plugins:shadow:5.2.0') {
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
}
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
classpath "com.palantir.gradle.gitversion:gradle-git-version:0.12.3"
classpath "org.gradle.playframework:gradle-playframework:0.12"
Expand All @@ -23,6 +20,7 @@ buildscript {

plugins {
id 'com.gorylenko.gradle-git-properties' version '2.4.0-rc2'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}

project.ext.spec = [
Expand Down Expand Up @@ -171,7 +169,7 @@ allprojects {
apply plugin: 'checkstyle'
}

configure(subprojects.findAll {it.name != 'spark-lineage'}) {
configure(subprojects.findAll {! it.name.startsWith('spark-lineage') }) {

configurations.all {
exclude group: "io.netty", module: "netty"
Expand Down Expand Up @@ -221,37 +219,14 @@ subprojects {
}
}

if (project.name != 'datahub-protobuf') {
tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(8)
}
}
tasks.withType(Test).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
}
}
} else {
tasks.withType(JavaExec).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(11)
}
tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(11)
}
tasks.withType(Javadoc).configureEach {
javadocTool = javaToolchains.javadocToolFor {
languageVersion = JavaLanguageVersion.of(11)
}
}
tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(11)
}
}
tasks.withType(Test).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(11)
}
}
tasks.withType(Test).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(11)
}
}

Expand Down
1 change: 1 addition & 0 deletions docker/broker/env/docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0
KAFKA_HEAP_OPTS=-Xms256m -Xmx256m
KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE=false
2 changes: 1 addition & 1 deletion docker/datahub-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FROM --platform=$BUILDPLATFORM node:16.13.0-alpine3.14 AS prod-build

# Upgrade Alpine and base packages
RUN apk --no-cache --update-cache --available upgrade \
&& apk --no-cache add perl openjdk8
&& apk --no-cache add perl openjdk8 openjdk11

ARG USE_SYSTEM_NODE="true"
ENV CI=true
Expand Down
2 changes: 1 addition & 1 deletion docker/datahub-gms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ FROM --platform=$BUILDPLATFORM alpine:3.14 AS prod-build

# Upgrade Alpine and base packages
RUN apk --no-cache --update-cache --available upgrade \
&& apk --no-cache add openjdk8 perl
&& apk --no-cache add openjdk8 openjdk11 perl

COPY . /datahub-src
RUN cd /datahub-src && ./gradlew :metadata-service:war:build -x test
Expand Down
2 changes: 1 addition & 1 deletion docker/datahub-ingestion/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG APP_ENV=prod

FROM acryldata/datahub-ingestion-base as base

FROM openjdk:8 as prod-build
FROM openjdk:11 as prod-build
COPY . /datahub-src
RUN cd /datahub-src && ./gradlew :metadata-events:mxe-schemas:build

Expand Down
2 changes: 1 addition & 1 deletion docker/datahub-mae-consumer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ FROM --platform=$BUILDPLATFORM alpine:3.14.2 AS prod-build

# Upgrade Alpine and base packages
RUN apk --no-cache --update-cache --available upgrade \
&& apk --no-cache add openjdk8 perl
&& apk --no-cache add openjdk8 openjdk11 perl

COPY . datahub-src
RUN cd datahub-src && ./gradlew :metadata-jobs:mae-consumer-job:build -x test
Expand Down
2 changes: 1 addition & 1 deletion docker/datahub-mce-consumer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ FROM --platform=$BUILDPLATFORM alpine:3.14.2 AS prod-build

# Upgrade Alpine and base packages
RUN apk --no-cache --update-cache --available upgrade \
&& apk --no-cache add openjdk8 perl
&& apk --no-cache add openjdk8 openjdk11 perl

COPY . datahub-src
RUN cd datahub-src && ./gradlew :metadata-jobs:mce-consumer-job:build
Expand Down
2 changes: 1 addition & 1 deletion docker/datahub-upgrade/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FROM --platform=$BUILDPLATFORM alpine:3.14 AS prod-build

# Upgrade Alpine and base packages
RUN apk --no-cache --update-cache --available upgrade \
&& apk --no-cache add openjdk8 perl
&& apk --no-cache add openjdk8 openjdk11 perl

COPY . datahub-src
RUN cd datahub-src && ./gradlew :datahub-upgrade:build
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-with-cassandra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
ports:
- "2181:2181"
volumes:
- zkdata:/var/opt/zookeeper
- zkdata:/var/lib/zookeeper

broker:
image: confluentinc/cp-kafka:5.4.0
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-without-neo4j.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
ports:
- ${DATAHUB_MAPPED_ZK_PORT:-2181}:2181
volumes:
- zkdata:/var/opt/zookeeper
- zkdata:/var/lib/zookeeper

broker:
image: confluentinc/cp-kafka:5.4.0
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
ports:
- ${DATAHUB_MAPPED_ZK_PORT:-2181}:2181
volumes:
- zkdata:/var/opt/zookeeper
- zkdata:/var/lib/zookeeper

broker:
image: confluentinc/cp-kafka:5.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0
- KAFKA_HEAP_OPTS=-Xms256m -Xmx256m
- KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE=false
hostname: broker
image: confluentinc/cp-kafka:7.2.0
ports:
Expand Down Expand Up @@ -176,7 +177,7 @@ services:
ports:
- ${DATAHUB_MAPPED_ZK_PORT:-2181}:2181
volumes:
- zkdata:/var/opt/zookeeper
- zkdata:/var/lib/zookeeper
version: '2.3'
volumes:
esdata: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0
- KAFKA_HEAP_OPTS=-Xms256m -Xmx256m
- KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE=false
hostname: broker
image: confluentinc/cp-kafka:5.4.0
ports:
Expand Down Expand Up @@ -178,7 +179,7 @@ services:
ports:
- ${DATAHUB_MAPPED_ZK_PORT:-2181}:2181
volumes:
- zkdata:/var/opt/zookeeper
- zkdata:/var/lib/zookeeper
version: '2.3'
volumes:
esdata: null
Expand Down
3 changes: 2 additions & 1 deletion docker/quickstart/docker-compose.quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0
- KAFKA_HEAP_OPTS=-Xms256m -Xmx256m
- KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE=false
hostname: broker
image: confluentinc/cp-kafka:5.4.0
ports:
Expand Down Expand Up @@ -198,7 +199,7 @@ services:
ports:
- ${DATAHUB_MAPPED_ZK_PORT:-2181}:2181
volumes:
- zkdata:/var/opt/zookeeper
- zkdata:/var/lib/zookeeper
version: '2.3'
volumes:
broker: null
Expand Down
6 changes: 3 additions & 3 deletions docs/developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ title: "Local Development"
# DataHub Developer's Guide

## Pre-requirements
- [Java 1.8 SDK](https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=hotspot)
- [Java 11 SDK](https://openjdk.org/projects/jdk/11/)
- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/)
- Docker engine with at least 8GB of memory to run tests.

:::note

Do not try to use a JDK newer than JDK 8. The build process does not work with newer JDKs currently.
Do not try to use a JDK newer than JDK 11. The build process does not work with newer JDKs currently.

:::

Expand Down Expand Up @@ -101,7 +101,7 @@ You're probably using a Java version that's too new for gradle. Run the followin
```
java --version
```
While it may be possible to build and run DataHub using newer versions of Java, we currently only support [Java 1.8](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html) (aka Java 8). Plan for Java 11 migration is being discussed in [this issue](https://github.com/datahub-project/datahub/issues/1699).
While it may be possible to build and run DataHub using newer versions of Java, we currently only support [Java 11](https://openjdk.org/projects/jdk/11/) (aka Java 11).

### Getting `cannot find symbol` error for `javax.annotation.Generated`

Expand Down
1 change: 1 addition & 0 deletions docs/how/updating-datahub.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This file documents any backwards-incompatible changes in DataHub and assists pe
## Next

### Breaking Changes
- Java version 11 or greater is required.

### Potential Downtime

Expand Down
11 changes: 11 additions & 0 deletions li-utils/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
apply plugin: 'java'
apply plugin: 'pegasus'

tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(8)
}
}
tasks.withType(Test).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
}
}

dependencies {
compile spec.product.pegasus.data
compile externalDependency.commonsLang
Expand Down
Loading

0 comments on commit 203a6ff

Please sign in to comment.