https://fedoramagazine.org/using-the-quarkus-framework-on-fedora-silverblue-just-a-quick-look/
Installing Silverblue
https://docs.fedoraproject.org/en-US/fedora-silverblue/installation/
顯示安裝的是jdk11
顯示的版本卻是jdk8
[root@localhost ]# java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b07)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 25.282-b07-jvmci-21.0-b06, mixed mode)
後來才發現是graalvm底下的jdk
[root@localhost ]# readlink -f $(which java)
/graalvm/bin/java
ref:
https://stackoverflow.com/questions/33104982/how-to-get-java-path-in-centos
sudo alternatives --config java
ref:
https://phoenixnap.com/kb/install-java-on-centos
https://github.com/redhat-developer-demos/quarkus-tutorial
(1)
sudo yum install maven
備註:需要3.5.3以上版本
可用mvn --version指令查看目前版本
RHEL更新Maven方式:
https://computingforgeeks.com/installing-latest-apache-maven-on-centos-fedora/
需先sudo yum remove maven
(2)
git clone https://github.com/redhat-developer-demos/quarkus-tutorial.git
(3)
cd quarkus-tutorial
(4)
export TUTORIAL_HOME='pwd'
export QUARKUS_VERSION=0.21.2
(5)
mvn "io.quarkus:quarkus-maven-plugin:$QUARKUS_VERSION:create" \
-DprojectGroupId="com.example" \
-DprojectArtifactId="fruits-app" \
-DprojectVersion="1.0-SNAPSHOT" \
-DclassName="FruitResource" \
-Dpath="fruit"
(6)
確認檔案已產生
cd fruits-app
ls -al
(7)
已開發模式啟動(具備Hot Reload功能)
./mvnw compile quarkus:dev
(8)
啟動後會看到以下訊息
2021-02-24 21:10:49,700 WARN [io.qua.dep.QuarkusAugmentor] (main) Using Java versions older than 11 to build Quarkus applications is deprecated and will be disallowed in a future release!
2021-02-24 21:10:52,875 INFO [io.quarkus] (Quarkus Main Thread) fruits-app 1.0-SNAPSHOT on JVM (powered by Quarkus 1.12.0.Final) started in 0.700s. Listening on: http://localhost:8080
2021-02-24 21:10:52,882 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-02-24 21:10:52,882 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy]
=======以下是改用Native模式編譯
(9)
oc new-project quarkustutorial
(10)
編譯成native executable(需安裝GraalVM)
./mvnw package -DskipTests -Pnative
Windows平台編譯問題請參考以下文章
https://quarkus.io/guides/building-native-image#producing-a-native-executable
如果沒安裝GraalVM,使用container runtime(預設是使用docker,可用下方指令指定)
./mvnw package -DskipTests -Pnative -Dquarkus.native.container-build=true
https://quarkus.io/guides/building-native-image#quarkus-native-pkg-native-config_quarkus.native.container-build
https://quarkus.io/guides/building-native-image
By default Quarkus automatically detects the container runtime. If you want to explicitely select the container runtime, you can do it with:
# Docker
./mvnw package -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=docker
# Podman
./mvnw package -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman