2021年2月24日 星期三

Redhat官方的quarkus demo code

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

1 則留言:

  1. A restoration program, one-on-one counseling, treatment, 온라인 카지노 and lifestyle modifications might allow you to overcome your playing addiction. If you don’t deal with your playing problem, it could possibly} result in critical financial points. It also can negatively affect on} your relationships with family members, associates, and others. Effective remedy might help you keep away from these consequences and mend your relationships via restoration. In some cases, you may need treatment to help you|that will help you|that can help you} overcome your playing urges. Your playing addiction might outcome from an underlying psychological health situation, similar to bipolar disorder.

    回覆刪除