Skip to content

Commit 8e227d5

Browse files
Upgrade to Java 11 (feast-dev#451)
* Upgrade to Java 11 * Add support for Java 1.8 in Maven enforcer Co-authored-by: David Heryanto <david.heryanto@hotmail.com>
1 parent baadbe7 commit 8e227d5

File tree

10 files changed

+61
-27
lines changed

10 files changed

+61
-27
lines changed

.prow/config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ presubmits:
6666
always_run: true
6767
spec:
6868
containers:
69-
- image: maven:3.6-jdk-8
69+
- image: maven:3.6-jdk-11
7070
command: [".prow/scripts/test-core-ingestion.sh"]
7171
resources:
7272
requests:
@@ -78,15 +78,15 @@ presubmits:
7878
always_run: true
7979
spec:
8080
containers:
81-
- image: maven:3.6-jdk-8
81+
- image: maven:3.6-jdk-11
8282
command: [".prow/scripts/test-serving.sh"]
8383

8484
- name: test-java-sdk
8585
decorate: true
8686
always_run: true
8787
spec:
8888
containers:
89-
- image: maven:3.6-jdk-8
89+
- image: maven:3.6-jdk-11
9090
command: [".prow/scripts/test-java-sdk.sh"]
9191

9292
- name: test-python-sdk
@@ -110,7 +110,7 @@ presubmits:
110110
always_run: true
111111
spec:
112112
containers:
113-
- image: maven:3.6-jdk-8
113+
- image: maven:3.6-jdk-11
114114
command: [".prow/scripts/test-end-to-end.sh"]
115115
resources:
116116
requests:
@@ -126,7 +126,7 @@ presubmits:
126126
secret:
127127
secretName: feast-service-account
128128
containers:
129-
- image: maven:3.6-jdk-8
129+
- image: maven:3.6-jdk-11
130130
command: [".prow/scripts/test-end-to-end-batch.sh"]
131131
resources:
132132
requests:
@@ -167,7 +167,7 @@ postsubmits:
167167
decorate: true
168168
spec:
169169
containers:
170-
- image: maven:3.6-jdk-8
170+
- image: maven:3.6-jdk-11
171171
command:
172172
- bash
173173
- -c

core/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,5 +197,11 @@
197197
<artifactId>spring-boot-test-autoconfigure</artifactId>
198198
<scope>test</scope>
199199
</dependency>
200+
201+
<dependency>
202+
<groupId>javax.xml.bind</groupId>
203+
<artifactId>jaxb-api</artifactId>
204+
</dependency>
205+
200206
</dependencies>
201207
</project>

core/src/main/java/feast/core/util/PipelineUtil.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
import java.net.URL;
2525
import java.net.URLClassLoader;
2626
import java.util.ArrayList;
27+
import java.util.Arrays;
2728
import java.util.List;
29+
import java.util.stream.Collectors;
2830

2931
public class PipelineUtil {
3032

@@ -45,12 +47,7 @@ public class PipelineUtil {
4547
public static List<String> detectClassPathResourcesToStage(ClassLoader classLoader)
4648
throws IOException {
4749
if (!(classLoader instanceof URLClassLoader)) {
48-
String message =
49-
String.format(
50-
"Unable to use ClassLoader to detect classpath elements. "
51-
+ "Current ClassLoader is %s, only URLClassLoaders are supported.",
52-
classLoader);
53-
throw new IllegalArgumentException(message);
50+
return getClasspathFiles();
5451
}
5552

5653
List<String> files = new ArrayList<>();
@@ -69,4 +66,11 @@ public static List<String> detectClassPathResourcesToStage(ClassLoader classLoad
6966
}
7067
return files;
7168
}
69+
70+
private static List<String> getClasspathFiles() {
71+
return Arrays.stream(System.getProperty("java.class.path").split(File.pathSeparator))
72+
.map(entry -> new File(entry).getPath())
73+
.collect(Collectors.toList());
74+
}
75+
7276
}

datatypes/java/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,11 @@
6868
<groupId>io.grpc</groupId>
6969
<artifactId>grpc-services</artifactId>
7070
</dependency>
71+
72+
<dependency>
73+
<groupId>javax.annotation</groupId>
74+
<artifactId>javax.annotation-api</artifactId>
75+
</dependency>
7176
</dependencies>
77+
7278
</project>

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The main components of Feast are:
1818

1919
**Pre-requisites**
2020

21-
* Java SDK version 8
21+
* Java SE Development Kit 11
2222
* Python version 3.6 \(or above\) and pip
2323
* Access to Postgres database \(version 11 and above\)
2424
* Access to [Redis](https://redis.io/topics/quickstart) instance \(tested on version 5.x\)

infra/docker/core/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# Build stage 1: Builder
33
# ============================================================
44

5-
FROM maven:3.6-jdk-8-slim as builder
5+
FROM maven:3.6-jdk-11-slim as builder
66
ARG REVISION=dev
77
COPY . /build
88
WORKDIR /build
99
#
10-
# Setting Maven repository .m2 directory relative to /build folder gives the
10+
# Setting Maven repository .m2 directory relative to /build folder gives the
1111
# user to optionally use cached repository when building the image by copying
1212
# the existing .m2 directory to $FEAST_REPO_ROOT/.m2
1313
#
@@ -29,7 +29,7 @@ RUN apt-get -qq update && apt-get -y install unar && \
2929
# Build stage 2: Production
3030
# ============================================================
3131

32-
FROM openjdk:8-jre as production
32+
FROM openjdk:11-jre as production
3333
ARG REVISION=dev
3434
COPY --from=builder /build/core/target/feast-core-$REVISION.jar /opt/feast/feast-core.jar
3535
COPY --from=builder /build/core/target/feast-core-$REVISION /opt/feast/feast-core

infra/docker/core/Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM openjdk:8-jre
1+
FROM openjdk:11-jre
22
ARG REVISION=dev
33
ADD $PWD/core/target/feast-core-$REVISION.jar /opt/feast/feast-core.jar
44
CMD ["java",\

infra/docker/serving/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# Build stage 1: Builder
33
# ============================================================
44

5-
FROM maven:3.6-jdk-8-slim as builder
5+
FROM maven:3.6-jdk-11-slim as builder
66
ARG REVISION=dev
77
COPY . /build
88
WORKDIR /build
99
#
10-
# Setting Maven repository .m2 directory relative to /build folder gives the
10+
# Setting Maven repository .m2 directory relative to /build folder gives the
1111
# user to optionally use cached repository when building the image by copying
1212
# the existing .m2 directory to $FEAST_REPO_ROOT/.m2
1313
#
@@ -19,10 +19,10 @@ RUN mvn --also-make --projects serving -Drevision=$REVISION \
1919
# Build stage 2: Production
2020
# ============================================================
2121

22-
FROM openjdk:8-jre-alpine as production
22+
FROM openjdk:11-jre-alpine as production
2323
ARG REVISION=dev
2424
#
25-
# Download grpc_health_probe to run health check for Feast Serving
25+
# Download grpc_health_probe to run health check for Feast Serving
2626
# https://kubernetes.io/blog/2018/10/01/health-checking-grpc-servers-on-kubernetes/
2727
#
2828
RUN wget -q https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.3.1/grpc_health_probe-linux-amd64 \

infra/docker/serving/Dockerfile.dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM openjdk:8-jre-alpine as production
1+
FROM openjdk:11-jre-alpine as production
22
ARG REVISION=dev
33
#
4-
# Download grpc_health_probe to run health check for Feast Serving
4+
# Download grpc_health_probe to run health check for Feast Serving
55
# https://kubernetes.io/blog/2018/10/01/health-checking-grpc-servers-on-kubernetes/
66
#
77
RUN wget -q https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.3.1/grpc_health_probe-linux-amd64 \

pom.xml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,18 @@
298298
<type>pom</type>
299299
<scope>import</scope>
300300
</dependency>
301+
302+
<dependency>
303+
<groupId>javax.xml.bind</groupId>
304+
<artifactId>jaxb-api</artifactId>
305+
<version>2.3.1</version>
306+
</dependency>
307+
<dependency>
308+
<groupId>javax.annotation</groupId>
309+
<artifactId>javax.annotation-api</artifactId>
310+
<version>1.3.2</version>
311+
</dependency>
312+
301313
</dependencies>
302314
</dependencyManagement>
303315

@@ -378,8 +390,7 @@
378390
<artifactId>maven-compiler-plugin</artifactId>
379391
<version>3.8.1</version>
380392
<configuration>
381-
<source>1.8</source>
382-
<target>1.8</target>
393+
<release>11</release>
383394
<compilerArgs>
384395
<arg>-Xlint:all</arg>
385396
<!-- -Xdoclint:all breaks on a false positive in JDK < 9 -->
@@ -392,6 +403,13 @@
392403
<groupId>org.apache.maven.plugins</groupId>
393404
<artifactId>maven-enforcer-plugin</artifactId>
394405
<version>3.0.0-M2</version>
406+
<dependencies>
407+
<dependency>
408+
<groupId>org.codehaus.mojo</groupId>
409+
<artifactId>extra-enforcer-rules</artifactId>
410+
<version>1.2</version>
411+
</dependency>
412+
</dependencies>
395413
<executions>
396414
<execution>
397415
<id>valid-build-environment</id>
@@ -401,10 +419,10 @@
401419
<configuration>
402420
<rules>
403421
<requireMavenVersion>
404-
<version>[3.5,4.0)</version>
422+
<version>[3.6,4.0)</version>
405423
</requireMavenVersion>
406424
<requireJavaVersion>
407-
<version>[1.8,1.9)</version>
425+
<version>[1.8,11.1)</version>
408426
</requireJavaVersion>
409427
<reactorModuleConvergence />
410428
</rules>

0 commit comments

Comments
 (0)