This is the 8th day of my participation in the August More Text Challenge. For details, see:August is more challenging

The environment

I am using Version 3.8.1 of Maven. I can use io. Quarkus: Quarkus-maven-Plugin :2.0.1.Final provided by Quarkus to quickly complete the Quarkus project.

Create a project

Use the following Maven commands to create a new project:

MVN IO. Quarkus: quarkus -- maven plugin: 2.0.1. Final: create \ - DprojectGroupId = top mjava \ - DprojectArtifactId = quarkus - demo \ - DprojectVersion = 1.0 \ - DclassName = "top. Mjava. Demo. Application"Copy the code

A folder with the same name as ArtifactId will be generated for the project in the current directory where the command is executed. If the folder already exists, the project will fail to be created.

Native and JVM dockerfiles are also generated in the SRC /main/docker directory. The instructions for building images and running containers are written in these dockerfiles.

Command description

attribute The default value describe
projectGroupId org.acme.sample The project’s GroupId
projectArtifactId No default value, but mandatory The project’s ArtifactId
projectVersion 1.0.0 - the SNAPSHOT Project version
platformGroupId io.quarkus The group ID of the target platform. Given that all existing platforms come from IO. Quarkus, this platform will not actually be explicitly used. But it is still an option.
platformArtifactId quarkus-universe-bom The artifact ID of the target platform BOM. In order to use a locally built Quarkus, it should be quarkus-BOM.
platformVersion If not specified, the latest one will be resolved. The version of the platform you want your project to use. It can also accept a version range, in which case the latest version in the specified range is used.
className If omitted, it is not created The fully qualified name of the generated resource
path /hello Resource path, which takes effect only when className is set.
extensions [] List of extensions to add to the project (comma separated)

Management extension

Once the project is created, you can go to the project folder and use short commands to manipulate the project, such as: MVN quarkus:[command]

View all extensions

mvn quarkus:list-extensions
Copy the code

This command displays all the extensions used by the current project.

➜ quarkus-demo: MVN Quarkus :list-extensions [INFO] Scanning for projects... [the INFO] [INFO] -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- < top. Mjava: quarkus - demo > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [INFO] Building quarkus - demo of 1.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- Quarkus-maven-plugin :2.0.1.Final:list-extensions (default-cli) @quarkus-demo -- [INFO] Current Quarkus Extensions available: [INFO] [INFO] Blaze-Persistence blaze-persistence-integration-quarkus [INFO] Camel ActiveMQ camel-quarkus-activemq [INFO] Camel Async HTTP Client (AHC) camel-quarkus-ahc [INFO] Camel Async HTTP Client (AHC) Websocket camel-quarkus-ahc-ws [INFO] Camel AMQP camel-quarkus-amqp ......Copy the code

Add extensions

mvn quarkus:add-extensions -Dextension=vertx
Copy the code

This command can be used to add extensions, such as the vertx extension for a project

➜ quarkus-demo: MVN quarkus: add-extensions-dextension =vertx [INFO] Extension for projects... [the INFO] [INFO] -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- < top. Mjava: quarkus - demo > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [INFO] Building quarkus - demo of 1.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- Quarkus-maven-plugin :2.0.1.Final: Add-extensions (default-cli) @quarkus-demo -- [INFO] [SUCCESS] ✅ Extension io.quarkus:quarkus-vertx has been installed [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [INFO] Total time: 2.370 s [INFO] Finished at: 2021-07-09T15:06:50+08:00 [INFO] ------------------------------------------------------------------------Copy the code

Delete extension

mvn quarkus:remove-extensions -Dextension=vertx
Copy the code

This command removes unused extensions, such as the vertx extension you just added

➜ quarkus-demo: MVN quarkus:remove- extensions-dextension =vertx [INFO] Scanning for projects... [the INFO] [INFO] -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- < top. Mjava: quarkus - demo > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [INFO] Building quarkus - demo of 1.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- Quarkus -- maven plugin: 2.0.1. Final: remove - extensions (default - cli) @ quarkus - demo - [INFO] [SUCCESS] ✅ Extension io.quarkus:quarkus-vertx has been uninstalled [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [INFO] Total time: 2.112 s [INFO] Finished at: 2021-07-09T15:08:48+08:00 [INFO] ------------------------------------------------------------------------Copy the code

The project build

Run the project

mvn quarkus:dev
Copy the code

Execute this command, the project will be run, at this point to http://localhost:8080/hello will get Hello RESTEasy output

quarkus-demo: mvn quarkus:dev [INFO] Scanning for projects... [the INFO] [INFO] -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- < top. Mjava: quarkus - demo > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [INFO] Building quarkus - demo of 1.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- Quarkus-maven-plugin :2.0.1.Final:dev (default-cli) @quarkus-demo -- -- [INFO] Invoking IO. Quarkus: quarkus -- maven plugin: 2.0.1. Final: the generate code @ quarkus - demo [INFO] Invoking Org, apache maven. Plugins: maven - resources - the plugin: 2.6: resources @ quarkus - demo/INFO Using utf-8 encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] Invoking Org, apache maven. Plugins: maven - compiler - plugin: 3.8.1: compile @ quarkus - demo [INFO] Nothing to compile - all classes are The up to date [INFO] Invoking org.. Apache maven. Plugins: maven - resources - the plugin: 2.6: testResources @ quarkus - demo Using [INFO]  'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/zheng/coding/study/quarkus-demo/src/test/resources [INFO] Invoking Org, apache maven. Plugins: maven - compiler - plugin: 3.8.1: testCompile @ quarkus - demo [INFO] Nothing to compile - all classes are up to date Listening for transport dt_socket at address: 5005 __ ____ ____ _____ _____ ____ _____ ______ - / __ / / / / / _ | / _ \ / / / _ / / / / __ / / / _ _ - / / / / / __ | /, _ /, / / __ / / \ \ - \ _ \ _ \ ____ _ / | _ / _ / | _ / _ / _ - | | \ _____ / ___ / 2021-07-09 15:16:47, 146 INFO/IO. Quarkus (quarkus Main Thread) Quarkus - Demo 1.0 on JVM (POWERED by Quarkus 2.0.1.Final) Started in 3.412s. Listening on: http://localhost:8080 2021-07-09 15:16:47,194 INFO [IO. Quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding Activated. 2021-07-09 15:16:47,199 INFO [IO. Quarkus] (Quarkus Main Thread) Installed Features: [cdi, resteasy, smallrye-context-propagation]Copy the code

Build the project

mvn quarkus:build
Copy the code

This command builds the project and creates a running JAR package in target/quarkus-app/

➜ Quarkus - Demo MVN Quarkus: Build [INFO] Build for projects... [the INFO] [INFO] -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- < top. Mjava: quarkus - demo > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [INFO] Building quarkus - demo of 1.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- Quarkus-maven-plugin: 2.0.1.final :build (default-cli) @quarkus-demo -- [INFO] [org.jboss.threads] JBoss Threads version 3.4.0. Final [INFO] [IO. Quarkus. Deployment. QuarkusAugmentor] quarkus augmentation completed in 1977 ms/INFO ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [INFO] Total time: 4.776 s [INFO] Finished at: 2021-07-09T15:13:54+08:00 [INFO] ------------------------------------------------------------------------Copy the code

conclusion

More commands can be viewed by executing the following commands. This article covers only a few common ones

MVN IO. Quarkus :quarkus-maven-plugin:2.0.1.Final:help // Or use the short MVN quarkus:help command in the project directoryCopy the code

Quarkus. IO/Guides/Mave…