Open5

Quarkus Getting Started

RyuSARyuSA

こんな環境で実施

# VSCodeのdevcontainer上で実施なう
vscode ➜ /workspaces/quarkus-getting $ java --version
openjdk 17.0.2 2022-01-18 LTS
OpenJDK Runtime Environment Microsoft-30338 (build 17.0.2+8-LTS)
OpenJDK 64-Bit Server VM Microsoft-30338 (build 17.0.2+8-LTS, mixed mode, sharing)

vscode ➜ /workspaces/quarkus-getting $ gradle -version

------------------------------------------------------------
Gradle 7.4.2
------------------------------------------------------------

Build time:   2022-03-31 15:25:29 UTC
Revision:     540473b8118064efcc264694cbcaa4b677f61041

Kotlin:       1.5.31
Groovy:       3.0.9
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.2 (Microsoft 17.0.2+8-LTS)
OS:           Linux 5.10.16.3-microsoft-standard-WSL2 amd64
RyuSARyuSA

公式に従ってCliを作成

vscode ➜ /workspaces/quarkus-getting $ curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
[jbang] Adding [https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/] to /home/vscode/.jbang/trusted-sources.json

vscode ➜ /workspaces/quarkus-getting $ curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio
[jbang] Command installed: quarku

sdkでインストールしてもよかったな……

RyuSARyuSA

プロジェクト初期化

vscode ➜ /workspaces/quarkus-getting $ quarkus create app --gradle --java 17 -o ./
-----------

applying codestarts...
📚  java
🔨  gradle
📦  quarkus
📝  config-properties
🔧  dockerfiles
🔧  gradle-wrapper
🚀  resteasy-codestart

-----------
[SUCCESS] ✅  quarkus project has been successfully generated in:
--> /workspaces/quarkus-getting/./code-with-quarkus
-----------
Navigate into this directory and get started: quarkus dev
RyuSARyuSA

初回起動~、qurkus-cliでえいや

vscode ➜ /workspaces/quarkus-getting $ quarkus dev

BUILD SUCCESSFUL in 4s
7 actionable tasks: 1 executed, 6 up-to-date
Listening for transport dt_socket at address: 5005

__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
2022-04-02 13:43:03,379 INFO  [io.quarkus] (Quarkus Main Thread) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.7.5.Final) started in 5.301s. Listening on: http://localhost:8080

2022-04-02 13:43:03,407 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-04-02 13:43:03,408 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy, smallrye-context-propagation, vertx]

8080番ポートで起動、いい感じ

RyuSARyuSA

task一覧表示してみる

vscode ➜ /workspaces/quarkus-getting $ ./gradlew tasks

> Task :tasks

------------------------------------------------------------
Tasks runnable from root project 'code-with-quarkus'
------------------------------------------------------------

Build tasks
-----------
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
nativeTestClasses - Assembles native test classes.
quarkusGeneratedSourcesClasses - Assembles quarkus generated sources classes.
quarkusTestGeneratedSourcesClasses - Assembles quarkus test generated sources classes.
testClasses - Assembles test classes.

Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.

Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'code-with-quarkus'.
dependencies - Displays all dependencies declared in root project 'code-with-quarkus'.
dependencyInsight - Displays the insight into a specific dependency in root project 'code-with-quarkus'.
help - Displays a help message.
javaToolchains - Displays the detected java toolchains.
outgoingVariants - Displays the outgoing variants of root project 'code-with-quarkus'.
projects - Displays the sub-projects of root project 'code-with-quarkus'.
properties - Displays the properties of root project 'code-with-quarkus'.
tasks - Displays the tasks runnable from root project 'code-with-quarkus'.

Quarkus tasks
-------------
addExtension - Adds Quarkus extensions specified by the user to the project.
listCategories - Lists quarkus extensions categories
listExtensions - Lists the available quarkus extensions
listPlatforms - Lists the available quarkus platforms
quarkusBuild - Quarkus builds a runner jar based on the build jar
quarkusDev - Development mode: enables hot deployment with background compilation
quarkusGenerateCode - Performs Quarkus pre-build preparations, such as sources generation
quarkusGenerateCodeDev - Performs Quarkus pre-build preparations, such as sources generation
quarkusGenerateCodeTests - Performs Quarkus pre-build preparations, such as sources generation
quarkusGoOffline - Resolve all dependencies for offline usage
quarkusInfo - Log Quarkus-specific project information, such as imported Quarkus platform BOMs, Quarkus extensions found among the project dependencies, etc.
quarkusRemoteDev - Remote development mode: enables hot deployment on remote JVM with background compilation
quarkusTest - Continuous testing mode: enables continuous testing without starting dev mode
quarkusTestConfig - Deprecated. Used to set the necessary system properties for the Quarkus tests to run. Replaced with an action configured for every test by the Quarkus plugin
quarkusUpdate - Log Quarkus-specific recommended project updates, such as the new Quarkus platform BOM versions, new versions of Quarkus extensions that aren't managed by the Quarkus BOMs, etc
removeExtension - Removes Quarkus extensions specified by the user to the project.

Verification tasks
------------------
check - Runs all checks.
test - Runs the test suite.
testNative - Runs native image tests

Quarkus周りのタスクがざっくり追加されてる、これらで起動できそう……quarkus-cli不要論出てきたな、よくできてる