Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/helidon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Configure Java 25
- name: Configure Java 27
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version: 25
java-version: 27
cache: 'gradle'
- name: Run tests
working-directory: ./${{ matrix.app }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reactive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Build Helidon project
run: |
cd reactive/helidon
docker build -t helidon -f Dockerfile.native .
docker build -t helidon -f Dockerfile.jlink .
docker tag helidon:latest mraible/helidon-reactive:latest
shell: bash

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ You can also build and run each example as a native app.
- Micronaut: `./gradlew nativeCompile`
- Quarkus: `quarkus build --native`
- Spring Boot: `./gradlew nativeCompile`
- Helidon: `mvn package -Pnative-image`
- Helidon: `mvn package -Pnative-image` (imperative) or `mvn package -Pjlink-image` (reactive, which uses a jlink image because no GraalVM release supports Java 27 yet)

Then, start each app as a native executable.

- Micronaut: `./build/native/nativeCompile/app`
- Quarkus: `./build/quarkus-1.0.0-SNAPSHOT-runner`
- Spring Boot: `./build/native/nativeCompile/spring-boot`
- Helidon: `./target/helidon`
- Helidon: `./target/helidon` (imperative) or `./target/helidon-jri/bin/start` (reactive)

## Links

Expand Down
5 changes: 3 additions & 2 deletions reactive/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ cd ../quarkus && ./gradlew build -Dquarkus.package.type=native
echo "Building Spring Boot..."
cd ../spring-boot && ./gradlew nativeCompile

echo "Building Helidon..."
cd ../helidon && mvn package -Pnative-image
echo "Building Helidon (jlink image with AOT cache, requires Java 27)..."
sdk use java 27.0.0.0+35-tem
cd ../helidon && mvn package -Pjlink-image
15 changes: 5 additions & 10 deletions reactive/demo.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -419,22 +419,17 @@ security:

http :8080/hello Authorization:"Bearer $TOKEN"

=== Build a native Helidon app with GraalVM
=== Build a Helidon jlink image with an AOT cache

. Update `src/main/resources/META-INF/native-image/com.example.rest/helidon/native-image.properties` so native compilation will work with Java 21.
+
[source,properties]
----
Args=--initialize-at-build-time=com.example.rest --enable-url-protocols=https
----
Helidon 27 requires Java 27, and no GraalVM release supports Java 27 yet, so this app uses a custom Java runtime image with an ahead-of-time (AOT) cache instead of a native executable.

. Compile your Helidon app into a native executable using the `native-image` profile:
. Build the runtime image using the `jlink-image` profile:

mvn package -Pnative-image
mvn package -Pjlink-image

. Start your Helidon app:

./target/helidon
./target/helidon-jri/bin/start

. Test your API with an access token.

Expand Down
4 changes: 2 additions & 2 deletions reactive/helidon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# 1st stage, build the app
FROM container-registry.oracle.com/java/openjdk:21 as build
FROM container-registry.oracle.com/java/openjdk:27-oraclelinux9 AS build

# Install maven
WORKDIR /usr/share
Expand All @@ -27,7 +27,7 @@ RUN mvn package -DskipTests
RUN echo "done!"

# 2nd stage, build the runtime image
FROM container-registry.oracle.com/java/openjdk:21
FROM container-registry.oracle.com/java/openjdk:27-oraclelinux9
WORKDIR /helidon

# Copy the binary built in the 1st stage
Expand Down
4 changes: 2 additions & 2 deletions reactive/helidon/Dockerfile.jlink
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# 1st stage, build the app
FROM container-registry.oracle.com/java/openjdk:21 as build
FROM container-registry.oracle.com/java/openjdk:27-oraclelinux9 AS build

WORKDIR /usr/share

Expand Down Expand Up @@ -28,7 +28,7 @@ RUN echo "done!"

# 2nd stage, build the final image with the JRI built in the 1st stage

FROM debian:stretch-slim
FROM container-registry.oracle.com/os/oraclelinux:9-slim
WORKDIR /helidon
COPY --from=build /helidon/target/helidon-jri ./
ENTRYPOINT ["/bin/bash", "/helidon/bin/start"]
Expand Down
39 changes: 0 additions & 39 deletions reactive/helidon/Dockerfile.native

This file was deleted.

2 changes: 1 addition & 1 deletion reactive/helidon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Sample Helidon SE project that includes multiple REST operations.
## Build and run


With JDK21
With JDK 27
```bash
mvn package
java -jar target/helidon.jar
Expand Down
2 changes: 1 addition & 1 deletion reactive/helidon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.helidon.applications</groupId>
<artifactId>helidon-se</artifactId>
<version>4.5.4</version>
<version>27.0.1</version>
<relativePath/>
</parent>
<groupId>com.example.rest</groupId>
Expand Down
3 changes: 2 additions & 1 deletion reactive/helidon/src/main/java/com/example/rest/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.example.rest.resource.HelloResource;
import io.helidon.config.Config;
import io.helidon.logging.common.LogConfig;
import io.helidon.service.registry.Services;
import io.helidon.webserver.WebServer;
import io.helidon.webserver.WebServerConfig;
import io.helidon.webserver.security.SecurityHttpFeature;
Expand All @@ -28,7 +29,7 @@ public static void main(String[] args) {

static void setup(WebServerConfig.Builder server) {
Config config = Config.create();
Config.global(config);
Services.set(Config.class, config);

server.routing(routing -> routing
.addFeature(SecurityHttpFeature.create(config.get("security.web-server")))
Expand Down

This file was deleted.

5 changes: 3 additions & 2 deletions reactive/memory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ case "$selected_app" in
start_command="./spring-boot/build/native/nativeCompile/spring-boot"
;;
"helidon")
start_command="./helidon/target/helidon"
start_command="./helidon/target/helidon-jri/bin/start"
process_name="helidon-jri"
;;
# Add more cases for other apps as needed
*)
Expand All @@ -32,7 +33,7 @@ case "$selected_app" in
esac

# Extract the executable name using basename
executable=$(basename "$start_command")
executable=${process_name:-$(basename "$start_command")}

# Define memory function
memory() {
Expand Down
2 changes: 1 addition & 1 deletion reactive/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ case "$selected_app" in
start_command="./spring-boot/build/native/nativeCompile/spring-boot"
;;
"helidon")
start_command="./helidon/target/helidon"
start_command="./helidon/target/helidon-jri/bin/start"
;;
# Add more cases for other apps as needed
*)
Expand Down
Loading