Skip to content

Commit

Permalink
Java 21 (#7222)
Browse files Browse the repository at this point in the history
* Java version and Java API changes

Signed-off-by: Tomas Langer <[email protected]>

* Remove --enable-preview from everywhere

Signed-off-by: Tomas Langer <[email protected]>

* Byte buddy support for Java 21 EA

Signed-off-by: Tomas Langer <[email protected]>

* Use random port even when setup sets explicit one in tests

Signed-off-by: Tomas Langer <[email protected]>

* Update spotbugs plugin to work with Java 21

Signed-off-by: Tomas Langer <[email protected]>

* Fix JPA issues, rollback to original JPA version.

Signed-off-by: Tomas Langer <[email protected]>

* Skip Jlink tests - need new version of build tools

Signed-off-by: Tomas Langer <[email protected]>

* Script fix

Signed-off-by: Tomas Langer <[email protected]>

* Use a deterministic version  for setup-java: v1.3.1 instead of v1

---------

Signed-off-by: Tomas Langer <[email protected]>
Co-authored-by: Romain Grecourt <[email protected]>
  • Loading branch information
tomas-langer and romain-grecourt authored Jul 20, 2023
1 parent d4c425b commit fb7585c
Show file tree
Hide file tree
Showing 79 changed files with 163 additions and 395 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ name: "Validate"
on: [pull_request, push]

env:
JAVA_VERSION: '20'
JAVA_DISTRO: 'oracle'
JAVA_RELEASE: '21'
JAVA_DISTRO: 'jdk.java.net'
HELIDON_PIPELINES: 'true'
MAVEN_HTTP_ARGS: '-Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -Dmaven.wagon.http.retryHandler.count=3'

Expand All @@ -25,10 +25,10 @@ jobs:
with:
fetch-depth: 0
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3.11.0
uses: oracle-actions/setup-java@v1.3.1
with:
distribution: ${{ env.JAVA_DISTRO }}
java-version: ${{ env.JAVA_VERSION }}
website: ${{ env.JAVA_DISTRO }}
release: ${{ env.JAVA_RELEASE }}
cache: maven
- name: Copyright
run: etc/scripts/copyright.sh
Expand All @@ -38,10 +38,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3.11.0
uses: oracle-actions/setup-java@v1.3.1
with:
distribution: ${{ env.JAVA_DISTRO }}
java-version: ${{ env.JAVA_VERSION }}
website: ${{ env.JAVA_DISTRO }}
release: ${{ env.JAVA_RELEASE }}
cache: maven
- name: Checkstyle
run: etc/scripts/checkstyle.sh
Expand All @@ -51,10 +51,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3.11.0
uses: oracle-actions/setup-java@v1.3.1
with:
distribution: ${{ env.JAVA_DISTRO }}
java-version: ${{ env.JAVA_VERSION }}
website: ${{ env.JAVA_DISTRO }}
release: ${{ env.JAVA_RELEASE }}
cache: maven
- name: Spotbugs
run: etc/scripts/spotbugs.sh
Expand All @@ -64,10 +64,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3.11.0
uses: oracle-actions/setup-java@v1.3.1
with:
distribution: ${{ env.JAVA_DISTRO }}
java-version: ${{ env.JAVA_VERSION }}
website: ${{ env.JAVA_DISTRO }}
release: ${{ env.JAVA_RELEASE }}
cache: maven
- name: Docs
run: etc/scripts/site.sh
Expand All @@ -80,10 +80,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3.11.0
uses: oracle-actions/setup-java@v1.3.1
with:
distribution: ${{ env.JAVA_DISTRO }}
java-version: ${{ env.JAVA_VERSION }}
website: ${{ env.JAVA_DISTRO }}
release: ${{ env.JAVA_RELEASE }}
cache: maven
- name: Maven build
run: etc/scripts/github-build.sh
Expand All @@ -96,10 +96,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3.11.0
uses: oracle-actions/setup-java@v1.3.1
with:
distribution: ${{ env.JAVA_DISTRO }}
java-version: ${{ env.JAVA_VERSION }}
website: ${{ env.JAVA_DISTRO }}
release: ${{ env.JAVA_RELEASE }}
cache: maven
- name: Maven build
run: |
Expand All @@ -116,10 +116,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3.11.0
uses: oracle-actions/setup-java@v1.3.1
with:
distribution: ${{ env.JAVA_DISTRO }}
java-version: ${{ env.JAVA_VERSION }}
website: ${{ env.JAVA_DISTRO }}
release: ${{ env.JAVA_RELEASE }}
cache: maven
- name: Maven build
run: etc/scripts/mp-tck.sh
Expand All @@ -132,10 +132,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3.11.0
uses: oracle-actions/setup-java@v1.3.1
with:
distribution: ${{ env.JAVA_DISTRO }}
java-version: ${{ env.JAVA_VERSION }}
website: ${{ env.JAVA_DISTRO }}
release: ${{ env.JAVA_RELEASE }}
cache: maven
- name: Test archetypes
run: etc/scripts/test-archetypes.sh
Expand All @@ -148,10 +148,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3.11.0
uses: oracle-actions/setup-java@v1.3.1
with:
distribution: ${{ env.JAVA_DISTRO }}
java-version: ${{ env.JAVA_VERSION }}
website: ${{ env.JAVA_DISTRO }}
release: ${{ env.JAVA_RELEASE }}
cache: maven
- name: Build Helidon
run: etc/scripts/github-compile.sh
Expand Down
1 change: 1 addition & 0 deletions .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Dnet.bytebuddy.experimental=true
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ Helidon supports two programming models:
In either case your application is just a Java SE program.

## Early access branch
This branch requires Java 20 early access release with Loom support.
Applications written using this version will require `--enable-preview` to be used when starting JVM.
This branch requires Java 21 early access release.
Kindly use latest official release to work with Java 17, unless you are interested in the newest and greatest!

## License
Expand Down
8 changes: 1 addition & 7 deletions applications/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
<maven.compiler.release>${maven.compiler.source}</maven.compiler.release>
<version.plugin.compiler>3.8.1</version.plugin.compiler>
Expand Down Expand Up @@ -77,7 +77,6 @@
<systemPropertyVariables>
<java.util.logging.config.file>${project.build.outputDirectory}/logging.properties</java.util.logging.config.file>
</systemPropertyVariables>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
<plugin>
Expand All @@ -87,7 +86,6 @@
<configuration>
<useModulePath>false</useModulePath>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -158,9 +156,6 @@
<version>${helidon.version}</version>
</dependency>
</dependencies>
<configuration>
<defaultJvmOptions>--enable-preview</defaultJvmOptions>
</configuration>
</plugin>
<plugin>
<groupId>io.helidon.build-tools</groupId>
Expand Down Expand Up @@ -205,7 +200,6 @@
<buildArgs>
<!-- Some native image features use the svm dependencies which require additional exports -->
<arg>--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.configure=ALL-UNNAMED</arg>
<arg>--enable-preview</arg>
</buildArgs>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# 1st stage, build the app
FROM ghcr.io/graalvm/graalvm-ce:ol9-java20-22.3.1 as build
FROM ghcr.io/graalvm/graalvm-ce:ol9-java21-22.3.1 as build

# Install native-image
RUN gu install native-image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
With JDK20
```bash
mvn package
java --enable-preview -jar target/{{artifactId}}.jar
java -jar target/{{artifactId}}.jar
```
{{/readme-run-commands}}

Expand Down
8 changes: 4 additions & 4 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
<version.lib.animal-sniffer>1.18</version.lib.animal-sniffer>
<version.lib.annotation-api>1.3.5</version.lib.annotation-api>
<version.lib.brave-opentracing>1.0.0</version.lib.brave-opentracing>
<version.lib.reactivestreams>1.0.4</version.lib.reactivestreams>
<version.lib.commons-logging>1.2</version.lib.commons-logging>
<version.lib.cron-utils>9.1.6</version.lib.cron-utils>
<version.lib.database.messaging>19.3.0.0</version.lib.database.messaging>
<version.lib.dropwizard.metrics>4.1.2</version.lib.dropwizard.metrics>
<version.lib.eclipselink>4.0.1</version.lib.eclipselink>
<version.lib.el-impl>4.0.2</version.lib.el-impl>
Expand All @@ -58,7 +58,7 @@
<version.lib.gson>2.9.0</version.lib.gson>
<version.lib.grpc>1.56.0</version.lib.grpc>
<version.lib.guava>32.0.1-jre</version.lib.guava>
<version.lib.h2>2.1.212</version.lib.h2>
<version.lib.h2>2.2.220</version.lib.h2>
<version.lib.hamcrest>1.3</version.lib.hamcrest>
<version.lib.handlebars>4.3.1</version.lib.handlebars>
<version.lib.hibernate>6.1.7.Final</version.lib.hibernate>
Expand Down Expand Up @@ -123,13 +123,12 @@
<version.lib.mongodb>4.9.1</version.lib.mongodb>
<version.lib.mssql-jdbc>8.4.1.jre8</version.lib.mssql-jdbc>
<version.lib.mysql-connector-java>8.0.28</version.lib.mysql-connector-java>
<version.lib.narayana>5.12.0.Final</version.lib.narayana>
<version.lib.narayana>5.13.1.Final</version.lib.narayana>
<version.lib.neo4j>4.4.11</version.lib.neo4j>
<version.lib.netty>4.1.94.Final</version.lib.netty>
<version.lib.netty-io_uring>0.0.8.Final</version.lib.netty-io_uring>
<version.lib.oci>3.12.1</version.lib.oci>
<version.lib.ojdbc8>21.3.0.0</version.lib.ojdbc8>
<version.lib.database.messaging>19.3.0.0</version.lib.database.messaging>
<version.lib.okhttp3>3.14.9</version.lib.okhttp3>
<version.lib.okio>1.17.5</version.lib.okio>
<version.lib.opentelemetry.semconv>1.22.0-alpha</version.lib.opentelemetry.semconv>
Expand All @@ -143,6 +142,7 @@
<version.lib.parsson>1.0.2</version.lib.parsson>
<version.lib.postgresql>42.4.3</version.lib.postgresql>
<version.lib.prometheus>0.16.0</version.lib.prometheus>
<version.lib.reactivestreams>1.0.4</version.lib.reactivestreams>
<version.lib.slf4j>2.0.0</version.lib.slf4j>
<version.lib.smallrye-openapi>3.3.4</version.lib.smallrye-openapi>
<version.lib.snakeyaml>2.0</version.lib.snakeyaml>
Expand Down
4 changes: 2 additions & 2 deletions docs/includes/prerequisites.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////

Copyright (c) 2022 Oracle and/or its affiliates.
Copyright (c) 2022, 2023 Oracle and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,7 +35,7 @@ ifndef::h1-prefix[:h1-prefix: SE]
|A Helidon {flavor-uc} Application | You can use your own application or use the
xref:{rootdir}/{flavor-lc}/guides/quickstart.adoc[Helidon {flavor-uc} Quickstart] to create a sample application.
// tag::prerequisites-table-details[]
|https://www.oracle.com/technetwork/java/javase/downloads[Java{nbsp}SE{nbsp}17] (http://jdk.java.net[Open{nbsp}JDK{nbsp}17]) |Helidon requires Java 17+.
|https://www.oracle.com/technetwork/java/javase/downloads[Java{nbsp}SE{nbsp}21] (http://jdk.java.net[Open{nbsp}JDK{nbsp}21]) |Helidon requires Java 21+.
|https://maven.apache.org/download.cgi[Maven 3.6.1+]|Helidon requires Maven 3.6.1+.
|https://docs.docker.com/install/[Docker 18.09+]|You need Docker if you
want to build and deploy Docker containers.
Expand Down
4 changes: 2 additions & 2 deletions docs/mp/persistence.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////

Copyright (c) 2022 Oracle and/or its affiliates.
Copyright (c) 2022, 2023 Oracle and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -251,7 +251,7 @@ managed]
<2> The `ojdbc11` artifact
https://www.oracle.com/database/technologies/maven-central-guide.html#:~:text=ojdbc11.jar,JDK14%20and%20JDK15[implements
relevant parts of the JDBC 4.3 specification], which forms part of
Java 17, which is the Java version targeted by Helidon 3.
Java 21, which is the Java version targeted by Helidon 4.
<3> The `scope` is `runtime`, indicating that the Oracle
JDBC driver classes will be available on the runtime classpath.
Expand Down
1 change: 1 addition & 0 deletions etc/copyright-exclude.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
jvm.config
.iml
.apt
.args
Expand Down
8 changes: 4 additions & 4 deletions etc/scripts/test-packaging-jar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ mvn ${MAVEN_ARGS} -e clean install
#
cd ${WS_DIR}/tests/integration/native-image/mp-1
# Classpath
java --enable-preview -jar target/helidon-tests-native-image-mp-1.jar
java -jar target/helidon-tests-native-image-mp-1.jar

# Module Path
java --enable-preview --module-path target/helidon-tests-native-image-mp-1.jar:target/libs \
java --module-path target/helidon-tests-native-image-mp-1.jar:target/libs \
--module helidon.tests.nimage.mp/io.helidon.tests.integration.nativeimage.mp1.Mp1Main

#
# Run MP-3 (just start and stop)
#
cd ${WS_DIR}/tests/integration/native-image/mp-3
# Classpath
java --enable-preview -Dexit.on.started=! -jar target/helidon-tests-native-image-mp-3.jar
java -Dexit.on.started=! -jar target/helidon-tests-native-image-mp-3.jar

# Module Path
java --enable-preview -Dexit.on.started=! \
java -Dexit.on.started=! \
--module-path target/helidon-tests-native-image-mp-3.jar:target/libs \
--add-modules helidon.tests.nimage.quickstartmp \
--module io.helidon.microprofile.cdi/io.helidon.microprofile.cdi.Main
9 changes: 5 additions & 4 deletions etc/scripts/test-packaging-jlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ cd ${WS_DIR}/tests/integration/native-image
# Prime build all native-image tests
mvn ${MAVEN_ARGS} -e clean install

echo Skipping jlink tests, until we switch to Smallrye based Jandex in build tools - org.jboss fails with NPE on Java 21
exit 0

# Build jlink images
# mp-2 fails because of https://github.com/oracle/helidon-build-tools/issues/478
readonly native_image_tests="mp-1 mp-3"
Expand All @@ -45,11 +48,10 @@ cd ${WS_DIR}/tests/integration/native-image/mp-1
jri_dir=${WS_DIR}/tests/integration/native-image/mp-1/target/helidon-tests-native-image-mp-1-jri

# Classpath
${jri_dir}/bin/start --jvm --enable-preview
${jri_dir}/bin/start

# Module Path
${jri_dir}/bin/java \
--enable-preview \
--module-path ${jri_dir}/app/helidon-tests-native-image-mp-1.jar:${jri_dir}/app/libs \
--module helidon.tests.nimage.mp/io.helidon.tests.integration.nativeimage.mp1.Mp1Main

Expand All @@ -58,11 +60,10 @@ cd ${WS_DIR}/tests/integration/native-image/mp-3
jri_dir=${WS_DIR}/tests/integration/native-image/mp-3/target/helidon-tests-native-image-mp-3-jri

# Classpath
${jri_dir}/bin/start --test --jvm --enable-preview
${jri_dir}/bin/start --test

# Module Path
${jri_dir}/bin/java -Dexit.on.started=! \
--enable-preview \
--module-path ${jri_dir}/app/helidon-tests-native-image-mp-3.jar:${jri_dir}/app/libs \
--add-modules helidon.tests.nimage.quickstartmp \
--module io.helidon.microprofile.cdi/io.helidon.microprofile.cdi.Main
3 changes: 1 addition & 2 deletions etc/scripts/test-packaging-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ mvn ${MAVEN_ARGS} --version
echo "GRAALVM_HOME=${GRAALVM_HOME}";
${GRAALVM_HOME}/bin/native-image --version;

# TODO:java19
echo Skipping native image tests, until we have a Java 19 build
echo Skipping native image tests, until we have a Java 21 build
exit 0

# Temporary workaround until job stages will share maven repository
Expand Down
9 changes: 0 additions & 9 deletions examples/jbatch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<compilerArg>--enable-preview</compilerArg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/messaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prerequisites
* Docker
* Java 17+
* Java 21+

### Test Kafka server
To make examples easily runnable,
Expand Down
2 changes: 1 addition & 1 deletion examples/messaging/jms-websocket-mp/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Helidon Messaging with JMS Example

## Prerequisites
* Java 17+
* Java 21+
* Docker
* [ActiveMQ server](../README.md) running on `localhost:61616`

Expand Down
Loading

0 comments on commit fb7585c

Please sign in to comment.