码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 深入淺出 Apache Maven 的 Plugins 外掛機制


    Apache Maven 之所以強大,是因為他有一個強大的 Plugin 執行框架,你任何想讓 Maven 幫你完成的工作,無論是建置(Build)、封裝(Packaging)、產生報表(Reporting)、執行測試(Tests),全部都是透過 Plugins 完成的。它除了內建的核心 Plugins 之外,還有數以百計的第三方 Plugins 可以安裝使用。今天這篇文章我就來介紹一下他的基本架構與使用方式。

    簡介 Apache Maven Plugins

    基本上 Apache Maven 的 Plugins 分成兩大類,並且可以定義在專案的 pom.xml 檔案中:

    1. 建置外掛 (Build plugins)

      用來執行在 建置 (build)過程中的所有大小事,他會定義在 POM 檔的  元素底下。

    2. 報表外掛 (Reporting plugins)

      用來執行在建立 文件網站 (site)過程中的所有大小事,他會定義在 POM 檔的  元素底下。

      由於 報表外掛 (Reporting plugins)的結果會被發佈在 文件網站 (site)上,所以必須考量 多國語系 (internationalized)與 本地化 (localized)的要求。詳見 Localization of Plugins 說明。

    Apache Maven 官方支援許多 Plugins,並且詳細列在 Available Plugins 頁面中,光是這些內建的 Plugins 就可以幫我們解決 95% 以上的建置或報表工作,真的相當厲害且富有內涵,我很難在一篇文章內介紹這麼多 Plugins,只能淺淺帶過,有興趣大家可以個別研究不同的 Plugins。

    突然覺得可以所有 Plugins 都介紹的話,那就可以參加 2022 iThome 鐵人賽 了吧!:sweat_smile:

    以下我就列出這些官方支援的 Plugins 清單,大家可以看的大概,有點印象即可:

    • 核心外掛 (Core plugins)

      Plugin 類型 摘要說明
      compiler 建置 Compiles Java sources.
      deploy 建置 Deploy the built artifact to the remote repository.
      failsafe 建置 Run the JUnit integration tests in an isolated classloader.
      install 建置 Install the built artifact into the local repository.
      resources 建置 Copy the resources to the output directory for including in the JAR.
      site 建置 Generate a site for the current project.
      surefire 建置 Run the JUnit unit tests in an isolated classloader.
      verifier 建置 Useful for integration tests - verifies the existence of certain conditions.
      clean 建置 Clean up after the build.
    • 封裝外掛 (Packaging types/tools)

      Plugin 類型 摘要說明
      jar 建置 Build a JAR ( Java ARchive ) from the current project.
      war 建置 Build a WAR ( Web Application Archive ) from the current project.
      ear 建置 Generate an EAR ( Enterprise ARchive ) from the current project.
      ejb 建置 Build an EJB (and optional client) from the current project.
      rar 建置 Build a RAR ( Resource Adapter Archive ) from the current project.
      app-client/acr 建置 Build a JavaEE application client from the current project.
      shade 建置 Build an Uber-JAR from the current project, including dependencies.
      source 建置 Build a source-JAR from the current project.
      jlink 建置 Build Java Run Time Image .
      jmod 建置 Build Java JMod files.
    • 報表外掛 (Reporting plugins)

      Plugin 類型 摘要說明
      changelog 報表 Generate a list of recent changes from your SCM.
      changes 建置+報表 Generate a report from an issue tracker or a change document.
      checkstyle 建置+報表 Generate a Checkstyle report.
      doap 建置 Generate a Description of a Project (DOAP) file from a POM.
      docck 建置 Documentation checker plugin.
  • 相关阅读:
    在Winform分页控件中集成保存用户列表显示字段及宽度调整设置
    Python入门必备基础
    十大经典排序算法——插入排序与希尔排序(超详解)
    【矩阵论】4.矩阵运算——广义逆——定义性质与特殊矩阵的广义逆
    LeetCode 69. x 的平方根
    『手撕Vue-CLI』处理不同指令
    候选键的确定方法-如何判断属性集U的子集K是否为候选键、如何找到关系模式的候选键
    全能赛道、热门方向、稀缺数据,“嬴彻-清华AIR杯”自动驾驶技术大赛火热开赛中
    高效偏振无关透射光栅的分析与设计
    扎克伯格说,Llama3-8B还是太大了,量化、剪枝、蒸馏准备上!
  • 原文地址:https://blog.csdn.net/ch98000/article/details/126816102
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号