关于后端:quarkus实战之五细说maven插件

51次阅读

共计 18253 个字符,预计需要花费 46 分钟才能阅读完成。

欢送拜访我的 GitHub

这里分类和汇总了欣宸的全副原创(含配套源码):https://github.com/zq2599/blog_demos

本篇概览

  • 本文是《quarkus 实战》系列的第五篇,一起去相熟 quarkus 的 maven 插件(就是下图红框中的那个 plugin),用好它能够使咱们更加得心应手的在我的项目中配置和管制 quarkus
  • 插件 <font color=”blue”>quarkus-maven-plugin</font> 提供了丰盛的性能,它们都有对应的命令,执行 <font color=”red”>mvn quarkus:xxx</font> 即可执行,其中 xxx 就是具体的命令,例如 <font color=”blue”>mvn quarkus:help</font>,接下来一起用实际操作来相熟这些命令

帮忙(help)

  • <font color=”blue”>mvn quarkus:help</font> 是首先要把握的命令,它通知了大家 quarkus 的 maven 插件到底有哪些能力,作为工具书,今后随时可能用到,如下所示,篇幅所限,仅列出局部内容:
% mvn quarkus:help
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:help (default-cli) @ hello-quarkus ---
[INFO] Quarkus Platform - Quarkus Maven Plugin 2.7.3.Final
  Quarkus Universe platform aggregates extensions from Quarkus Core and those
  developed by the community into a single compatible and versioned set that
  application developers can reference from their applications to align the
  dependency versions

This plugin has 25 goals:

quarkus:add-extension
  Allow adding an extension to an existing pom.xml file. Because you can add one
  or several extension in one go, there are 2 mojos: add-extensions and
  add-extension. Both supports the extension and extensions parameters.

quarkus:add-extensions
  Allow adding extensions to an existing pom.xml file. Because you can add one
  or several extension in one go, there are 2 mojos: add-extensions and
  add-extension. Both supports the extension and extensions parameters.

quarkus:analyze-call-tree
  Analyze call tree of a method or a class based on an existing report produced
  by Substrate when using -H:+PrintAnalysisCallTree, and does a more meaningful
  analysis of what is causing a type to be retained.

quarkus:build
  Builds the Quarkus application.
...  

创立工程(create)

  • 首先要把握的 mvn 命令是创立工程,回顾前文中创立工程的命令:
mvn "io.quarkus:quarkus-maven-plugin:create" \
  -DprojectGroupId="com.bolingcavalry" \
  -DprojectArtifactId="hello-quarkus" \
  -DprojectVersion="1.0-SNAPSHOT" \
  -DclassName="HobbyResource" \
  -Dpath="actions"
  • 创立工程时有很多参数能够设置,它们的默认值的作用如下表
参数 默认值 阐明
projectGroupId org.acme.sample group id,GAV 坐标中的 G
projectArtifactId mandatory artifact id,GAV 坐标中的 A
projectVersion 1.0.0-SNAPSHOT version,GAV 坐标中的 V
platformGroupId io.quarkus.platform 在依赖 quarkus 的 BOM,以及 quarkus 插件时,都要指定 GAV,这是 G
platformArtifactId quarkus-bom 在依赖 quarkus 的 BOM,以及 quarkus 插件时,都要指定 GAV,这是 A
platformVersion 2.7.1.Final 在依赖 quarkus 的 BOM,以及 quarkus 插件时,都要指定 GAV,这是 V,默认值会自动更新到最新稳定版
className 无默认值 指定后,会主动创立一个类
path 无默认值 如果指定了 className,此时再指定 path 的话,path 会作为类的 web 接口的 path
extensions 所需的 quarkus 插件列表
quarkusRegistryClient true 是否联网获取最新的 quarkus 插件列表,如果设置为 false,列表只能依据 BOM 获取,得不到最新的在线数据

查看工程信息(info)

  • 查看工程信息的命令是 <font color=”blue”>mvn quarkus:info</font>,应用频率很高,如下,能够察看以后的 BOM 和扩大插件状况:
(base) willdeMBP:hello-quarkus will$ mvn quarkus:info
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.1.Final:info (default-cli) @ hello-quarkus ---
[WARNING] quarkus:info goal is experimental, its options and output may change in future versions
[INFO] Looking for the newly published extensions in registry.quarkus.io
[INFO] Quarkus platform BOMs:
[INFO]   io.quarkus:quarkus-bom:pom:2.7.1.Final
[INFO] 
[INFO] Extensions from io.quarkus:quarkus-bom:
[INFO]   io.quarkus:quarkus-arc
[INFO]   io.quarkus:quarkus-resteasy
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.828 s
[INFO] Finished at: 2022-03-04T08:40:44+08:00
[INFO] ------------------------------------------------------------------------

paltform 列表(list-platforms)

  • 回顾我的项目的 pom.xml 文件,如下图,红框中是依赖的平台信息,所有 quarkus 依赖库都由这个平台对立治理
  • 上图红框中的平台,在 quarkus 中有多个,咱们能够依照本人的理论状况抉择,quarkus 插件的 list-platforms 命令能够查看一共有哪些平台类型,残缺命令是
mvn quarkus:list-platforms
  • 控制台输入所有平台信息
% mvn quarkus:list-platforms
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:list-platforms (default-cli) @ hello-quarkus ---
[INFO] io.quarkus.platform:quarkus-bom::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-optaplanner-bom::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-kogito-bom::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-qpid-jms-bom::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-cassandra-bom::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-amazon-services-bom::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-camel-bom::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-hazelcast-client::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-debezium-bom::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-blaze-persistence-bom::pom:2.7.3.Final
[INFO] io.quarkus.platform:quarkus-google-cloud-services-bom::pom:2.7.3.Final
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

扩大组件:查看(list-extensions)

  • 扩大组件 (extensions) 是 quarkus 的一大特色,web、序列化、数据库等丰盛的性能,都有对应的组件提供
  • 命令 <font color=”blue”>mvn quarkus:list-extensions</font> 能够查看反对的扩大组件列表:
(base) willdeMBP:hello-quarkus will$ mvn quarkus:list-extensions
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.1.Final:list-extensions (default-cli) @ hello-quarkus ---
[INFO] Looking for the newly published extensions in registry.quarkus.io
[INFO] Current Quarkus extensions available: 
[INFO] 
[INFO] ✬ ArtifactId                                         Extension Name
[INFO] ✬ quarkus-agroal                                     Agroal - Database connection pool
[INFO] ✬ quarkus-amazon-lambda                              AWS Lambda
[INFO] ✬ quarkus-amazon-lambda-http                         AWS Lambda HTTP
[INFO] ✬ quarkus-amazon-lambda-rest                         AWS Lambda Gateway REST API
[INFO] ✬ quarkus-amazon-lambda-xray                         AWS Lambda X-Ray
[INFO] ✬ quarkus-apicurio-registry-avro                     Apicurio Registry - Avro
[INFO] ✬ quarkus-avro                                       Apache Avro
[INFO] ✬ quarkus-awt                                        AWT
[INFO] ✬ quarkus-azure-functions-http                       Azure Functions HTTP
[INFO] ✬ quarkus-cache                                      Cache
[INFO] ✬ quarkus-config-yaml                                YAML Configuration
...
  • 如果想看更丰盛的信息,能够减少参数 <font color=”blue”>-Dformat=full</font>,如下图红框所示,新增了两个字段:

扩大组件:查看分类(list-categories)

  • 间接用 list-extensions 命令能够看到所有扩大组件,咱们当然不会全副都用,所以最好能有个分类的性能,而后咱们在适合的类目中找寻本人须要的组件
  • quarkus 曾经为咱们筹备好了分类性能,首先,执行以下命令查看有哪些分类(-Dformat 参数可选,有了它会展现更具体的信息)
mvn quarkus:list-categories -Dformat=full
  • 控制台输入如下,列出了所有分类和阐明
% mvn quarkus:list-categories -Dformat=full
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:list-categories (default-cli) @ hello-quarkus ---
[INFO] Available Quarkus extension categories: 
[INFO] 
[INFO] Category                       CategoryId           Description
[INFO] Alternative languages          alt-languages        Support for other JVM based languages
[INFO] Alternative languages          alternative-languages Support for other JVM based languages
[INFO] Business Automation            business-automation  Rules engine, BPM, etc
[INFO] Cloud                          cloud                Useful for Cloud Native deployments platforms like Kubernetes and cloud providers
[INFO] Compatibility                  compatibility        Support for alternative programming models on Quarkus
[INFO] Core                           core                 Core Quarkus components: engine, logging, etc.
[INFO] Data                           data                 Accessing and managing your data (RDBMS, NoSQL, caching, transaction management, etc)
[INFO] Integration                    integration          Connectors to read to write from a skew of systems (file, S#, Twitter, etc)
[INFO] Messaging                      messaging            Send and receives message to various messaging systems (AMQP, KAfka etc)
[INFO] Miscellaneous                  miscellaneous        Mixed bag of good stuff
[INFO] Observability                  observability        Metrics, tracing, etc
[INFO] Reactive                       reactive             Non blocking stack and connectors
[INFO] Security                       security             Everything you need to secure your application
[INFO] Serialization                  serialization        Serializing and deserializing various formats
[INFO] Web                            web                  Everything you need for REST endpoints, HTTP and web formats like JSON
[INFO] gRPC                           grpc                 gRPC integration
[INFO] 
[INFO] To list extensions in given category, use:
`./mvnw quarkus:list-extensions -Dcategory="categoryId"`
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
  • 如果我对音讯相干的组件感兴趣,能够看 <font color=”blue”>messaging</font> 这个类目,命令是
mvn quarkus:list-extensions -Dcategory="messaging"
  • 此时控制台会列出 <font color=”blue”>messaging</font> 这个类目下的所有组件
% mvn quarkus:list-extensions -Dcategory="messaging"              
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:list-extensions (default-cli) @ hello-quarkus ---
[INFO] Current Quarkus extensions available: 
[INFO] 
[INFO] ✬ ArtifactId                                         Extension Name
[INFO]   quarkus-artemis-jms                                Artemis JMS
[INFO] ✬ quarkus-google-cloud-pubsub                        Google Cloud Pubsub
[INFO] ✬ quarkus-kafka-client                               Apache Kafka Client
[INFO] ✬ quarkus-kafka-streams                              Apache Kafka Streams
[INFO] ✬ quarkus-qpid-jms                                   AMQP 1.0 JMS client - Apache Qpid JMS
[INFO]   quarkus-rabbitmq-client                            RabbitMQ Client
[INFO]   quarkus-reactive-messaging-http                    Reactive HTTP and WebSocket Connector
[INFO] ✬ quarkus-smallrye-reactive-messaging                SmallRye Reactive Messaging
[INFO] ✬ quarkus-smallrye-reactive-messaging-amqp           SmallRye Reactive Messaging - AMQP Connector
[INFO] ✬ quarkus-smallrye-reactive-messaging-kafka          SmallRye Reactive Messaging - Kafka Connector
[INFO] ✬ quarkus-smallrye-reactive-messaging-mqtt           SmallRye Reactive Messaging - MQTT Connector
[INFO] ✬ quarkus-smallrye-reactive-messaging-rabbitmq       SmallRye Reactive Messaging - RabbitMQ Connector
[INFO] 
[INFO] To get more information, append `-Dformat=full` to your command line.
[INFO] 
[INFO] Add an extension to your project by adding the dependency to your pom.xml or use `./mvnw quarkus:add-extension -Dextensions="artifactId"`
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

扩大组件:增加(add-extension、add-extensions)

  • 用 <font color=”blue”>mvn quarkus:list-extensions</font> 列出所有扩大组件后,可依据理论须要将列出的组件退出本人我的项目,例如我须要 <font color=”blue”>quarkus-jackson</font> 这个组件,执行以下命令即可
mvn quarkus:add-extension -Dextensions="quarkus-jackson"
  • 控制台输入如下,提醒增加胜利
% mvn quarkus:add-extension -Dextensions="quarkus-jackson"
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:add-extension (default-cli) @ hello-quarkus ---
[INFO] [SUCCESS] ✅  Extension io.quarkus:quarkus-jackson has been installed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.756 s
[INFO] Finished at: 2022-03-05T15:36:40+08:00
[INFO] ------------------------------------------------------------------------
  • 再去看 pom.xml,如下图红框,文件已被改变,新增依赖 <font color=”blue”>quarkus-jackson</font>
  • 还能够同时增加多个,命令是 <font color=”blue”>add-extensions</font>,留神 <font color=”red”>多了个 s </font>,多个组件之间用逗号分隔
mvn quarkus:add-extensions -Dextensions="quarkus-jdbc-mysql,quarkus-config-yaml"
  • 为了不便用户,add-extensions 除了准确匹配,还会含糊查找,输出上面的命令试试
quarkus:add-extensions -Dextensions="agroal"
  • 控制台输入如下,<font color=”blue”>quarkus-agroal</font> 会被找到并增加
% mvn quarkus:add-extensions -Dextensions="agroal"   
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:add-extensions (default-cli) @ hello-quarkus ---
[INFO] [SUCCESS] ✅  Extension io.quarkus:quarkus-agroal has been installed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.832 s
[INFO] Finished at: 2022-03-05T16:16:53+08:00
[INFO] ------------------------------------------------------------------------
  • 当匹配后果有多个的时候,quarkus 插件会提醒失败,以 jdbc 为例,如下所示,有多个匹配后果,因而 quarkus 插件不晓得该选哪个,就报错了:
% mvn quarkus:add-extension -Dextensions="jdbc"   
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:add-extension (default-cli) @ hello-quarkus ---
[INFO] [ERROR] ❗  Multiple extensions matching 'jdbc'
     - io.quarkus:quarkus-agroal
     - io.quarkus:quarkus-elytron-security-jdbc
     - io.quarkus:quarkus-jdbc-db2
     - io.quarkus:quarkus-jdbc-derby
     - io.quarkus:quarkus-jdbc-h2
     - io.quarkus:quarkus-jdbc-mariadb
     - io.quarkus:quarkus-jdbc-mssql
     - io.quarkus:quarkus-jdbc-mysql
     - io.quarkus:quarkus-jdbc-oracle
     - io.quarkus:quarkus-jdbc-postgresql
     - org.kie.kogito:kogito-addons-quarkus-persistence-jdbc
     - org.apache.camel.quarkus:camel-quarkus-jdbc
     Be more specific e.g using the exact name or the full GAV.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.500 s
[INFO] Finished at: 2022-03-05T16:18:34+08:00
[INFO] ------------------------------------------------------------------------
  • 再用 info 命令查看以后工程,能够看到方才增加的组件
[INFO] Quarkus platform BOMs:
[INFO]   io.quarkus.platform:quarkus-bom:pom:2.7.3.Final
[INFO] 
[INFO] Extensions from io.quarkus.platform:quarkus-bom:
[INFO]   io.quarkus:quarkus-jackson
[INFO]   io.quarkus:quarkus-config-yaml
[INFO]   io.quarkus:quarkus-arc
[INFO]   io.quarkus:quarkus-jdbc-mysql
[INFO]   io.quarkus:quarkus-resteasy
[INFO]   io.quarkus:quarkus-agroal
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

扩大组件:删除(remove-extension、remove-extensions)

  • 如果要删除已增加的 quarkus 组件,例如 <font color=”blue”>quarkus-jackson</font>,执行以下命令即可
mvn quarkus:remove-extension -Dextensions="quarkus-jackson"
  • 控制台输出如下,提醒删除胜利,再去看 pom.xml 发现 quarkus-jackson 的依赖也曾经被删除了
% mvn quarkus:remove-extension -Dextensions="quarkus-jackson"    
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:remove-extension (default-cli) @ hello-quarkus ---
[INFO] [SUCCESS] ✅  Extension io.quarkus:quarkus-jackson has been uninstalled
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
  • 也有批量删除性能,命令是 <font color=”blue”>remove-extensions</font>,留神 <font color=”red”>多了个 s </font>,多个组件之间用逗号分隔
mvn quarkus:remove-extensions -Dextensions="quarkus-config-yaml,quarkus-jdbc-mysql"
  • 控制台输入
% mvn quarkus:remove-extensions -Dextensions="quarkus-config-yaml,quarkus-jdbc-mysql"
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:remove-extensions (default-cli) @ hello-quarkus ---
[INFO] [SUCCESS] ✅  Extension io.quarkus:quarkus-config-yaml has been uninstalled
[INFO] [SUCCESS] ✅  Extension io.quarkus:quarkus-jdbc-mysql has been uninstalled
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
  • 再用 info 命令查看以后工程,被删除的组件已不在列表
% mvn quarkus:info
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.3.Final:info (default-cli) @ hello-quarkus ---
[WARNING] quarkus:info goal is experimental, its options and output may change in future versions
[INFO] Looking for the newly published extensions in registry.quarkus.io
[INFO] Quarkus platform BOMs:
[INFO]   io.quarkus.platform:quarkus-bom:pom:2.7.3.Final
[INFO] 
[INFO] Extensions from io.quarkus.platform:quarkus-bom:
[INFO]   io.quarkus:quarkus-arc
[INFO]   io.quarkus:quarkus-resteasy
[INFO]   io.quarkus:quarkus-agroal
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

查看依赖树(dependency-tree)

  • 咱们罕用 <font color=”blue”>mvn dependency:tree</font> 命令查看 maven 工程的依赖树,此命令是依据 pom.xml 的依赖信息剖析出所有间接和间接依赖关系,然而,在 quarkus 利用中存在一些非凡状况:quarkus 的 maven 插件参加了构建,它会依据以后的 quarkus 扩大组件(extensions)去增加对应的依赖,这是 maven 自身不晓得的,因而,举荐应用 <font color=”blue”>mvn quarkus:dependency-tree</font> 命令查看 quarkus 利用的依赖关系:
(base) willdeMBP:hello-quarkus will$ mvn quarkus:dependency-tree
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.bolingcavalry:hello-quarkus >-------------------
[INFO] Building hello-quarkus 1.0-SNAPSHOT
[INFO] --------------------------------[jar]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:2.7.1.Final:dependency-tree (default-cli) @ hello-quarkus ---
[INFO] Quarkus application PROD mode build dependency tree:
[INFO] com.bolingcavalry:hello-quarkus:pom:1.0-SNAPSHOT
[INFO] ├─ io.quarkus:quarkus-arc-deployment:jar:2.7.1.Final (compile)
[INFO] │  ├─ io.quarkus:quarkus-core-deployment:jar:2.7.1.Final (compile)
[INFO] │  │  ├─ org.aesh:readline:jar:2.2 (compile)
[INFO] │  │  │  └─ org.fusesource.jansi:jansi:jar:1.18 (compile)
[INFO] │  │  ├─ org.aesh:aesh:jar:2.6 (compile)
[INFO] │  │  ├─ org.apache.commons:commons-lang3:jar:3.12.0 (compile)
[INFO] │  │  ├─ org.wildfly.common:wildfly-common:jar:1.5.4.Final-format-001 (compile)
...

离线构建(go-offline)

  • 先回顾一个 maven 命令 <font color=”blue”>mvn dependency:go-offline</font>,其作用是事后下载所有依赖库到本地,这样构建的时候就算没有网络,也能胜利构建
  • 然而对于 quarkus 利用,因为 quarkus 扩大组件(extensions)不能被 maven 辨认和解决,因而无奈剖析出这些 quarkus 扩大组件的依赖库,导致 <font color=”blue”>mvn dependency:go-offline</font> 命令无奈下载这些依赖库
  • 为了解决上述问题,倡议应用 <font color=”blue”>mvn quarkus:go-offline</font> 命令,此命令会剖析扩大组件的依赖项,而后下载缓存到本地

更多信息

  • 如果您想了更深刻理解 quarkus 插件的细节,能够参考官网文档:https://quarkus.io/guides/maven-tooling

欢送关注思否:程序员欣宸

学习路上,你不孤独,欣宸原创一路相伴 …

正文完
 0