当前位置: 首页 > news >正文

网站的性能特点免费的网页游戏

网站的性能特点,免费的网页游戏,泰安二手房,中科网站建设项目构建 什么是构建#xff1f; 项目构建指的是将源代码和资源文件转换为可执行或可分发的软件制品#xff08;如 JAR、WAR 文件#xff09;的过程。这个过程不仅包括编译代码#xff0c;还包括运行测试、打包、部署等步骤。Maven 提供了一套标准化的方法来处理这些任务…项目构建 什么是构建 项目构建指的是将源代码和资源文件转换为可执行或可分发的软件制品如 JAR、WAR 文件的过程。这个过程不仅包括编译代码还包括运行测试、打包、部署等步骤。Maven 提供了一套标准化的方法来处理这些任务使得构建过程更加自动化和可重复。如下图所示 构建过程的几个主要环节 清理删除以前的编译结果为重新编译做好准备。编译将 Java 源程序编译为字节码文件。测试针对项目中的关键点进行测试确保项目在迭代开发过程中关键点的正确性。报告在每一次测试后以标准的格式记录和展示测试结果。打包将一个包含诸多文件的工程封装为一个压缩文件用于安装或部署。Java 工程对应 jar 包Web 工程对应 war 包。安装在 Maven 环境下特指将 jar 包安装到本地仓库中。这样该项目就可以被其他的 Maven 项目通过依赖的方式引入。部署将 jar 包部署到私服上。 因此上面的整个流程称为构建而不是一个或几个步骤。 自动化构建 看一个小故事 这是阳光明媚的一天。托马斯像往常一样早早的来到了公司冲好一杯咖啡进入了自己的邮箱。很不幸QA 小组发来了一封邮件报告了他昨天提交的模块的测试结果有 BUG。“好吧反正也不是第一 次”托马斯摇摇头进入 IDE运行自己的程序编译、打包、部署到服务器上然后按照邮件中的操作路径进行测试。“嗯没错这个地方确实有问题”托马斯说道。于是托马斯开始尝试修复这个 BUG当他差不多有眉目的时候已经到了午饭时间。下午继续工作。BUG 很快被修正了接着托马斯对模块重新进行了编译、打包、部署测试之后确认没有问题了回复了 QA 小组的邮件。 一天就这样过去了明媚的阳光化作了美丽的晚霞托马斯却觉得生活并不像晚霞那样美好啊。 让我们来梳理一下托马斯这一天中的工作内容 从中我们发现托马斯的很大一部分时间花在了编译、打包、部署、测试这些流程化的工作上面而真正需要由人的智慧实现的分析问题和编码却只占了很少一部分。 能否将这些程式化的工作交给机器自动完成呢——当然可以这就是自动化构建。 此时 Maven 的意义就体现出来了它可以自动的从构建过程的起点一直执行到终点也就是一键式构建 反应堆机制Reactor Mechanism 什么是反应堆 Maven 中处理多模块项目的机制称为 reactor反应堆。作用如下 收集要构建的所有可用模块给收集到的模块指定一个构建顺序按顺序构建选定的模块 反应堆如何确定多个模块的构建顺序 由于多模块构建中的模块之间可能相互依赖因此反应堆必须对所有项目进行排序以确保任何项目在需要之前就已构建完成。 排序规则如下 项目依赖于构建中的另一个模块如果一个模块依赖于另一个模块则被依赖的模块会被优先构建。这是确保所有依赖项在使用它们的模块之前已经被构建和安装。插件声明其中插件是构建中的另一个模块如果一个模块使用的插件是由构建中的另一个模块提供的那么该插件模块将被优先构建。插件依赖于构建中的另一个模块如果一个模块使用的插件本身依赖于构建中的另一个模块那么这个被依赖的模块也会被优先构建。构建扩展声明为构建中的另一个模块如果一个模块定义了构建扩展并且这个扩展是由构建中的另一个模块提供的那么提供扩展的模块将会被优先构建。 元素中声明的顺序当上述规则不适用时即模块之间没有相互依赖关系、插件声明或构建扩展依赖的情况下Maven 将按照modules元素中列出的顺序来构建模块。 另外Maven 在确定反应堆排序reactor sort order时只会考虑实例化的引用。这意味着只有实际使用的依赖和插件实际在dependencies部分声明的依赖、实际在buildplugins部分声明并使用的插件才会影响构建顺序而dependencyManagement和pluginManagement中声明的元素不会直接影响反应堆排序。 附由于 Maven 官方或第三方提供的插件几乎能满足企业开发中需求所以 2 ~ 4 条规则很少会涉及到。 需求一构建整个项目 准备工作 1、创建项目添加子模块 为了演示多模块项目的构建创建了一个名为 big-marketing-wheel 的项目。 如下图所示big-marketing-wheel 是一个多模块的 Spring BootMaven项目的骨架。该骨架不包含任何业务代码。 项目地址https://github.com/Acura-bit/big-marketing-wheel.git 2、修改父 pom 在各个子模块的 pom 文件中引入了一些依赖但这些依赖不影响本节要演示的项目构建。其中模块间相互依赖关系如下图所示。该项目只是为了演示在实际场景中模块间的依赖关系不会是这样的。 父 pom 的自模块声明如下所示 modulesmodulebig-marketing-wheel-api/modulemodulebig-marketing-wheel-app/modulemodulebig-marketing-wheel-domain/modulemodulebig-marketing-wheel-trigger/modulemodulebig-marketing-wheel-infrastructure/modulemodulebig-marketing-wheel-types/module /modules构建项目 1、在 IntelliJ IDEA 中进入到 Terminal如下图所示 其实也就是在父工程的 pom 文件即 big-marketing-wheel\pom.xml 下执行构建命令。 我们的目的是想观察不同模块的构建顺序可以执行任意的生命周期这里我们执行 install 命令。 2、执行 mvn install 命令将整个项目打包安装到本地仓库 项目的构建过程如所示。 (base) PS C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel mvn install [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] big-marketing-wheel [pom] [INFO] big-marketing-wheel-types [jar] [INFO] big-marketing-wheel-api [jar] [INFO] big-marketing-wheel-app [jar] [INFO] big-marketing-wheel-infrastructure [jar] [INFO] big-marketing-wheel-trigger [jar] [INFO] big-marketing-wheel-domain [jar] [INFO] [INFO] ------------------ cn.myphoenix:big-marketing-wheel ------------------ [INFO] Building big-marketing-wheel 1.0-SNAPSHOT [1/7] [INFO] from pom.xml [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-whee[debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-types --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-types --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-types --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-types --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\big-marketing-wheel-types.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-types --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\big-marketing-wheel-types.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-types\1.0-SNAPSHOT\big-marketing-wheel-types-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-types\1.0-SNAPSHOT\big-marketing-wheel-types-1.0-SNAPSHOT.pom [INFO] [INFO] ---------------- cn.myphoenix:big-marketing-wheel-api ---------------- [INFO] Building big-marketing-wheel-api 1.0-SNAPSHOT [3/7] [INFO] from big-marketing-wheel-api\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-api --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-api --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-api --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-api --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-api --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\target\big-marketing-wheel-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-api --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\target\big-marketing-wheel-api-1.0-SNAPSHOT.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-api\1.0-SNAPSHOT\big-marketing-wheel-api-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-api\1.0-SNAPSHOT\big-marketing-wheel-api-1.0-SNAPSHOT.pom [INFO] [INFO] ---------------- cn.myphoenix:big-marketing-wheel-app ---------------- [INFO] Building big-marketing-wheel-app 1.0-SNAPSHOT [4/7] [INFO] from big-marketing-wheel-app\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-app --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] Copying 7 resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-app --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 6 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-app --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-app --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.6:test (default-test) big-marketing-wheel-app --- [INFO] Tests are skipped. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-app --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\target\big-marketing-wheel-app.jar [INFO] [INFO] --- spring-boot-maven-plugin:2.7.12:repackage (repackage) big-marketing-wheel-app --- [INFO] Layout: JAR [INFO] Replacing main artifact with repackaged archive [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-app --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\target\big-marketing-wheel-app.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-app\1.0-SNAPSHOT\big-marketing-wheel-app-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-app\1.0-SNAPSHOT\big-marketing-wheel-app-1.0-SNAPSHOT.pom [INFO] [INFO] ---------- cn.myphoenix:big-marketing-wheel-infrastructure ----------- [INFO] Building big-marketing-wheel-infrastructure 1.0-SNAPSHOT [5/7] [INFO] from big-marketing-wheel-infrastructure\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-infrastructure --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-infrastructure --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 7 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-infrastructure --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-infrastructure --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-infrastructure --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-infrastructure --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\target\big-marketing-wheel-infrastructure.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-infrastructure --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\target\big-marketing-wheel-infrastructure.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-infrastructure\1.0-SNAPSHOT\big-marketing-wheel-infrastructure-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-infrastructure\1.0-SNAPSHOT\big-marketing-wheel-infrastructure-1.0-SNAPSHOT.pom [INFO] [INFO] -------------- cn.myphoenix:big-marketing-wheel-trigger -------------- [INFO] Building big-marketing-wheel-trigger 1.0-SNAPSHOT [6/7] [INFO] from big-marketing-wheel-trigger\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-trigger --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-trigger --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-trigger --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-trigger --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-trigger --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-trigger --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\target\big-marketing-wheel-trigger.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-trigger --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\target\big-marketing-wheel-trigger.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-trigger\1.0-SNAPSHOT\big-marketing-wheel-trigger-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-trigger\1.0-SNAPSHOT\big-marketing-wheel-trigger-1.0-SNAPSHOT.pom [INFO] [INFO] -------------- cn.myphoenix:big-marketing-wheel-domain --------------- [INFO] Building big-marketing-wheel-domain 1.0-SNAPSHOT [7/7] [INFO] from big-marketing-wheel-domain\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-domain --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-domain --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 12 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-domain --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-domain --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-domain --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-domain --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\big-marketing-wheel-domain.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-domain --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\big-marketing-wheel-domain.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-domain\1.0-SNAPSHOT\big-marketing-wheel-domain-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-domain\1.0-SNAPSHOT\big-marketing-wheel-domain-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for big-marketing-wheel 1.0-SNAPSHOT: [INFO] [INFO] big-marketing-wheel ................................ SUCCESS [ 0.201 s] [INFO] big-marketing-wheel-types .......................... SUCCESS [ 2.621 s] [INFO] big-marketing-wheel-api ............................ SUCCESS [ 1.019 s] [INFO] big-marketing-wheel-app ............................ SUCCESS [ 3.252 s] [INFO] big-marketing-wheel-infrastructure ................. SUCCESS [ 0.823 s] [INFO] big-marketing-wheel-trigger ........................ SUCCESS [ 0.104 s] [INFO] big-marketing-wheel-domain ......................... SUCCESS [ 0.891 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9.146 s [INFO] Finished at: 2024-12-13T21:22:4608:00 [INFO] ------------------------------------------------------------------------结论 (1) 由标红处可以看到Maven 的反应堆给出了模块的构建顺序 big-marketing-wheel → big-marketing-wheel-types → big-marketing-wheel-api → big-marketing-wheel-app → big-marketing-wheel-infrastructure → big-marketing-wheel-trigger → big-marketing-wheel-domain (2) 由标绿处可以看到每个模块的构建过程是相互独立的并且是从 default 生命周期的头开始执行一直到 install 阶段。 (3) 在 Maven 本地仓库找到 install 的内容如下图所示父工程和子工程位于不同的文件夹中。 思考反应堆的模块构建顺序是如何得到的 项目的构建顺序如下所示 [INFO] big-marketing-wheel [pom] [INFO] big-marketing-wheel-types [jar] [INFO] big-marketing-wheel-api [jar] [INFO] big-marketing-wheel-app [jar] [INFO] big-marketing-wheel-infrastructure [jar] [INFO] big-marketing-wheel-trigger [jar] [INFO] big-marketing-wheel-domain [jar]解释 由反应堆确定模块构建顺序的原则可知在执行项目构建时先读取父 pom 文件的 modules 标签如果当前 module 有依赖的 module则先构建被依赖的 module再构建当前 module。构建过程如下 big-marketing-wheel-api api 模块依赖于 types 模块不能直接加入构建序列types 模块没有依赖的模块则 types[1] 模块加入构建序列依赖项 types 模块已加入构建序列则 api[2] 模块可以加入构建序列。 big-marketing-wheel-app app 模块依赖于types 模块而 types 模块已经加入到构建序列则 app[3] 模块可以加入到构建序列。 big-marketing-wheel-domain domain 模块依赖于 infrastructure、trigger且后两者尚未加入到构建序列所以此时不能将 domain 加入到构建序列 infrastructure[4] 模块没有依赖项可以加入到构建序列trigger[5] 模块没有依赖项可以加入到构建序列。 domain[6] 模块的所有依赖项已加入到构建序列其可以加入到构建序列。 上述过程可以参照父 pom 声明子模块的顺序和子模块间的相互依赖关系如下图所示 需求二构建某个子模块 场景 types 模块被 api 和 app 依赖当 types 模块有修改时我们希望 api 和 app 也能构建。只构建这 3 个模块而不是将所有的模块都重新构建。 types 模块只是被 2 个模块依赖真实的企业项目可能会存在一个模块被很多模块依赖的情况。如果每次修改这个模块时我们都要重新打包所有的模块那构建时间可能会非常久。有没有什么办法实现按需构建呢 Maven 提供了命令行选项可以实现实现按需构建下面介绍一些命令行选项 命令行选项 1、-pl 等价于--projects arg。作用构建指定的模块而不是构建整个项目。arg 表示多个模块之间用逗号分开模块有两种写法 # 写法一 -pl 模块1相对路径 [,模块2相对路径] [,模块n相对路径]# 写法一 -pl [模块1的groupId]:模块1的artifactId [,[模块2的groupId]:模块2的artifactId, [模块n的groupId]:模块n的artifactId]演示 依旧在项目根目录 big-marketing-wheel\pom.xml 下执行构建命令 (1) 构建 types 模块 # 写法一 mvn install -pl big-marketing-wheel-types# 写法二 (1) mvn install -pl cn.myphoenix:big-marketing-wheel-types# 写法二 (2) mvn install -pl :big-marketing-wheel-types说明虽然写法一和写法二 (2)很相似但含义完全不同。在写法一中“big-marketing-wheel-types” 表示该子模块的相对路径而在写法二 (2) 中“big-marketing-wheel-types” 则表示该子模块的的 artifactId。 上述命令的执行结果相同如下所示 (base) PS C:\...\big-marketing-wheel mvn install -pl cn.myphoenix:big-marketing-wheel-types [INFO] Scanning for projects... [INFO] [INFO] --------------- cn.myphoenix:big-marketing-wheel-types --------------- [INFO] Building big-marketing-wheel-types 1.0-SNAPSHOT [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-types --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-types --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-types --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-types --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\big-marketing-wheel-types.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-types --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\big-marketing-wheel-types.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-types\1.0-SNAPSHOT\big-marketing-wheel-types-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-types\1.0-SNAPSHOT\big-marketing-wheel-types-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.863 s [INFO] Finished at: 2024-12-13T21:57:5208:00 [INFO] ------------------------------------------------------------------------(2) 构建 domain 模块 执行构建命令 mvn install -pl :big-marketing-wheel-domain构建结果如下 (base) PS C:\...\big-marketing-wheel mvn install -pl :big-marketing-wheel-domain [INFO] Scanning for projects... [INFO] [INFO] -------------- cn.myphoenix:big-marketing-wheel-domain --------------- [INFO] Building big-marketing-wheel-domain 1.0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-domain --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-domain --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 12 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-domain --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-domain --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-domain --- [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-domain --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-domain --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\big-marketing-wheel-domain.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-domain --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\big-marketing-wheel-domain.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-domain\1.0-SNAPSHOT\big-marketing-wheel-domain-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-domain\1.0-SNAPSHOT\big-marketing-wheel-domain-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.766 s [INFO] Finished at: 2024-12-13T22:02:2108:00 [INFO] ------------------------------------------------------------------------可以看到只构建了 domain 模块它的依赖项 infrastructure 和 trigger 都没有构建。 2、-am 等价于--also-make 作用同时构建当前模块 x 的依赖模块也就是 x 依赖的模块也一同构建。 演示 在前面构建 domain 模块时我们使用了 -pl 选项发现只构建了 domain 模块而其依赖的 infrastructure 和 trigger 都没有构建。 现在我们使用 -am 选项就可以将 domain 的依赖项一同完成构建 mvn install -pl :big-marketing-wheel-domain -am构建过程如下 (base) PS C:\...\big-marketing-wheel mvn install -pl :big-marketing-wheel-domain -am [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] big-marketing-wheel [pom] [INFO] big-marketing-wheel-infrastructure [jar] [INFO] big-marketing-wheel-trigger [jar] [INFO] big-marketing-wheel-domain [jar] [INFO] [INFO] ------------------ cn.myphoenix:big-marketing-wheel ------------------ [INFO] Building big-marketing-wheel 1.0-SNAPSHOT [1/4] [INFO] from pom.xml [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel\1.0-SNAPSHOT\big-marketing-wheel-1.0-SNAPSHOT.pom [INFO] [INFO] ---------- cn.myphoenix:big-marketing-wheel-infrastructure ----------- [INFO] Building big-marketing-wheel-infrastructure 1.0-SNAPSHOT [2/4] [INFO] from big-marketing-wheel-infrastructure\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-infrastructure --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-infrastructure --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 7 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-infrastructure --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-infrastructure --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-infrastructure --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-infrastructure --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\target\big-marketing-wheel-infrastructure.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-infrastructure --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\target\big-marketing-wheel-infrastructure.jarto C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-infrastructure\1.0-SNAPSHOT\big-marketing-wheel-infrastructure-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-infrastructure\1.0-SNAPSHOT\big-marketing-wheel-infrastructure-1.0-SNAPSHOT.pom [INFO] [INFO] -------------- cn.myphoenix:big-marketing-wheel-trigger -------------- [INFO] Building big-marketing-wheel-trigger 1.0-SNAPSHOT [3/4] [INFO] from big-marketing-wheel-trigger\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-trigger --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-trigger --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-trigger --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-trigger --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-trigger --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-trigger --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\target\big-marketing-wheel-trigger.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-trigger --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\target\big-marketing-wheel-trigger.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-trigger\1.0-SNAPSHOT\big-marketing-wheel-trigger-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-trigger\1.0-SNAPSHOT\big-marketing-wheel-trigger-1.0-SNAPSHOT.pom [INFO] [INFO] -------------- cn.myphoenix:big-marketing-wheel-domain --------------- [INFO] Building big-marketing-wheel-domain 1.0-SNAPSHOT [4/4] [INFO] from big-marketing-wheel-domain\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-domain --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-domain --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 12 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-domain --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-domain --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-domain --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-domain --- [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-domain --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\big-marketing-wheel-domain.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-domain\1.0-SNAPSHOT\big-marketing-wheel-domain-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-domain\1.0-SNAPSHOT\big-marketing-wheel-domain-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for big-marketing-wheel 1.0-SNAPSHOT: [INFO] [INFO] big-marketing-wheel ................................ SUCCESS [ 0.169 s] [INFO] big-marketing-wheel-infrastructure ................. SUCCESS [ 2.357 s] [INFO] big-marketing-wheel-trigger ........................ SUCCESS [ 0.208 s] [INFO] big-marketing-wheel-domain ......................... SUCCESS [ 1.029 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.997 s [INFO] Finished at: 2024-12-13T22:15:0108:00 [INFO] ------------------------------------------------------------------------可以看到不仅构建了 domain 模块该模块的依赖项 infrastructure 和 trigger 也一同完成了构建。 3、-amd 等价于--also-make-dependents作用同时构建依赖于当前模块 x 的其他模块就是哪些模块依赖了 x 模块也一同构建 演示 使用此选项可以实现场景中提到的需求即构建 types 模块可以将 api 和 app 一同构建而且不需要重新构建整个项目。 mvn install -pl :big-marketing-wheel-types -amd构建过程如下 (base) PS C:\...\big-marketing-wheel mvn install -pl :big-marketing-wheel-types -amd [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] big-marketing-wheel-types [jar] [INFO] big-marketing-wheel-api [jar] [INFO] big-marketing-wheel-app [jar] [INFO] [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-types --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-types --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-types --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-types --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\big-marketing-wheel-types.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-types --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\big-marketing-wheel-types.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-types\1.0-SNAPSHOT\big-marketing-wheel-types-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-types\1.0-SNAPSHOT\big-marketing-wheel-types-1.0-SNAPSHOT.pom [INFO] [INFO] ---------------- cn.myphoenix:big-marketing-wheel-api ---------------- [INFO] Building big-marketing-wheel-api 1.0-SNAPSHOT [2/3] [INFO] from ..\big-marketing-wheel-api\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-api --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-api --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-api --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-api --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-api --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\target\big-marketing-wheel-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-api --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\target\big-marketing-wheel-api-1.0-SNAPSHOT.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-api\1.0-SNAPSHOT\big-marketing-wheel-api-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-api\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-api\1.0-SNAPSHOT\big-marketing-wheel-api-1.0-SNAPSHOT.pom [INFO] [INFO] ---------------- cn.myphoenix:big-marketing-wheel-app ---------------- [INFO] Building big-marketing-wheel-app 1.0-SNAPSHOT [3/3] [INFO] from ..\big-marketing-wheel-app\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-app --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] Copying 7 resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-app --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 6 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-app --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-app --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.6:test (default-test) big-marketing-wheel-app --- [INFO] Tests are skipped. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-app --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\target\big-marketing-wheel-app.jar [INFO] [INFO] --- spring-boot-maven-plugin:2.7.12:repackage (repackage) big-marketing-wheel-app --- [INFO] Layout: JAR [INFO] Replacing main artifact with repackaged archive [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-app --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\target\big-marketing-wheel-app.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-app\1.0-SNAPSHOT\big-marketing-wheel-app-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-app\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-app\1.0-SNAPSHOT\big-marketing-wheel-app-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for big-marketing-wheel-types 1.0-SNAPSHOT: [INFO] [INFO] big-marketing-wheel-types .......................... SUCCESS [ 2.766 s] [INFO] big-marketing-wheel-api ............................ SUCCESS [ 1.059 s] [INFO] big-marketing-wheel-app ............................ SUCCESS [ 3.719 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7.766 s [INFO] Finished at: 2024-12-13T22:20:4408:00 [INFO] ------------------------------------------------------------------------可以看到在构建 types 模块时依赖 types 模块的 api 和 app 也完成了构建。 4、-rf 等价于--resume-from arg作用跳过所有在此之前已经成功构建的模块并从指定的模块开始继续构建。 演示 在需求一构建整个项目一节中模块的构建顺序如下所示 [INFO] big-marketing-wheel [pom] [INFO] big-marketing-wheel-types [jar] [INFO] big-marketing-wheel-api [jar] [INFO] big-marketing-wheel-app [jar] [INFO] big-marketing-wheel-infrastructure [jar] [INFO] big-marketing-wheel-trigger [jar] [INFO] big-marketing-wheel-domain [jar]加入在构建 infrastructure 模块时失败了现在我们想从 infrastructure 继续构建而不是从头开始构建有什么办法吗 可以使用 -rf 选项从指定模块开始构建 mvn install -rf :big-marketing-wheel-infrastructure构建过程如下 (base) PS C:\...\big-marketing-wheel mvn install -rf :big-marketing-wheel-infrastructure [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] big-marketing-wheel-infrastructure [jar] [INFO] big-marketing-wheel-trigger [jar] [INFO] big-marketing-wheel-domain [jar] [INFO] [INFO] ---------- cn.myphoenix:big-marketing-wheel-infrastructure ----------- [INFO] Building big-marketing-wheel-infrastructure 1.0-SNAPSHOT [1/3] [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-infrastructure --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-infrastructure --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 7 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-infrastructure --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-infrastructure --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-infrastructure --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-infrastructure --- [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-infrastructure --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\target\big-marketing-wheel-infrastructure.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-infrastructure\1.0-SNAPSHOT\big-marketing-wheel-infrastructure-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-infrastructure\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-infrastructure\1.0-SNAPSHOT\big-marketing-wheel-infrastructure-1.0-SNAPSHOT.pom [INFO] [INFO] -------------- cn.myphoenix:big-marketing-wheel-trigger -------------- [INFO] Building big-marketing-wheel-trigger 1.0-SNAPSHOT [2/3] [INFO] from ..\big-marketing-wheel-trigger\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-trigger --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-trigger --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-trigger --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-trigger --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-trigger --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-trigger --- [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-trigger --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\target\big-marketing-wheel-trigger.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-trigger\1.0-SNAPSHOT\big-marketing-wheel-trigger-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-trigger\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-trigger\1.0-SNAPSHOT\big-marketing-wheel-trigger-1.0-SNAPSHOT.pom [INFO] [INFO] -------------- cn.myphoenix:big-marketing-wheel-domain --------------- [INFO] Building big-marketing-wheel-domain 1.0-SNAPSHOT [3/3] [INFO] from ..\big-marketing-wheel-domain\pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-domain --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\main\resources [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-domain --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 12 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-domain --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-domain --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-domain --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-domain --- [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) big-marketing-wheel-domain --- [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\target\big-marketing-wheel-domain.jar to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-domain\1.0-SNAPSHOT\big-marketing-wheel-domain-1.0-SNAPSHOT.jar [INFO] Installing C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-domain\pom.xml to C:\Softwares\Developer_Kits\apache-maven-3.8.8\repository\cn\myphoenix\big-marketing-wheel-domain\1.0-SNAPSHOT\big-marketing-wheel-domain-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for big-marketing-wheel-infrastructure 1.0-SNAPSHOT: [INFO] [INFO] big-marketing-wheel-infrastructure ................. SUCCESS [ 2.218 s] [INFO] big-marketing-wheel-trigger ........................ SUCCESS [ 0.177 s] [INFO] big-marketing-wheel-domain ......................... SUCCESS [ 0.947 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.574 s [INFO] Finished at: 2024-12-14T10:17:4908:00 [INFO] ------------------------------------------------------------------------可以看到确实是从 infrastructure 模块开始构建的。 附需要指出的是在构建某个子模块一节中笔者举得例子都是执行 install。但在项目构建一节中构建指的是从清理到部署的整个流程也就是整个生命周期。由于 install 也是生成了 jar 包所以也就当做构建了。 思考 1 使用 -rf 指定开始恢复的模块后就一定会从此模块开始构建吗 1、将安装到本地 Maven 仓库的三个文件夹删除 2、执行命令 mvn install -rf :big-marketing-wheel-domain构建过程如下 (base) PS C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel mvn install -rf big-marketing-wheel-domain [INFO] Scanning for projects... [INFO] [INFO] -------------- cn.myphoenix:big-marketing-wheel-domain --------------- [INFO] Building big-marketing-wheel-domain 1.0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The POM for cn.myphoenix:big-marketing-wheel-infrastructure:jar:1.0-SNAPSHOT is missing, no dependency information available [WARNING] The POM for cn.myphoenix:big-marketing-wheel-trigger:jar:1.0-SNAPSHOT is missing, no dependency information available [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.410 s [INFO] Finished at: 2024-12-14T10:38:5908:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project big-marketing-wheel-domain: Could not resolve dependencies for project cn.myphoenix:big-marketing-wheel-domain:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: cn.myphoenix:big-marketing-wheel-infrastructure:jar:1.0-SNAPSHOT, cn.myphoenix:big-marketing-wheel-trigger:jar:1.0-SNAPSHOT: Could not find artifact cn.myphoenix:big-marketing-wheel-infrastructure:jar:1.0-SNAPSHOT - [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException可以看到发生了错误错误原因是 domain 依赖 infrastructure 和 trigger而本地 Maven 仓库的 infrastructure 和 trigger 已经被删除了domain 找不到所以报错。 因此-rf 确实是从指定模块 x 开始构建的。如果模块 x 的所有依赖项都已经构建成功则模块 x 构建成功否则模块 x 构建失败。 一般情况下我们使用 -rf 的目的是从指定模块开始构建默认指定模块 x 依赖的模块已经构建成功。 思考 2 另外我又想到了一个问题如果模块 m 上一次构建成功假设为打包操作。紧接着 情况 1再次执行打包操作情况 2修改了模块 a 的内容然后再次打包 Maven 会如何处理这两种情况 准备工作 在 types 模块中进行实验types 模块的结构如下所示 实验步骤 1、创建 3 个类 BasketballSports用于演示文件内增加代码FootballSports用于演示文件内减少代码TennisSports用于演示删除整个文件。 2、只打包 types 模块 mvn package -pl big-marketing-wheel-types3、修改类文件 在 BasketballSports#playBasketball 内添加代码在 FootballSports#playFootball 内删减代码删除 TennisSports增加 VolleyballSports 类 4、再次打包 types 模块 mvn package -pl big-marketing-wheel-types结果如下图所示可以看到Maven 进行了重新遍历并重新打包。说明了情况 2。 另外 也可以从命令行的日志观察 (base) PS C:\...\big-marketing-wheel mvn package -pl big-marketing-wheel-types [INFO] Scanning for projects... [INFO] [INFO] --------------- cn.myphoenix:big-marketing-wheel-types --------------- [INFO] Building big-marketing-wheel-types 1.0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-types --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-types --- [INFO] Changes detected - recompiling the module! [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-types --- [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-types --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\big-marketing-wheel-types.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-types --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\classes [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-types --- [INFO] Changes detected - recompiling the module! [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-types --- [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-types --- [INFO] Building jar: C:\Coding_Gallery\Intellij_IDEA_Workspace\big-marketing-wheel\big-marketing-wheel-types\target\big-marketing-wheel-types.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.750 s [INFO] Finished at: 2024-12-14T15:15:2008:00 [INFO] ------------------------------------------------------------------------由标绿部分可以看到compiler 插件检测到了代码发生了改变重新进行了编译即使没有执行 clean 操作jar 插件依旧重新进行了打包操作。 5、不做任何更改再次打包 types 模块 mvn package -pl big-marketing-wheel-types结果如下 (base) PS C:\...\big-marketing-wheel mvn package -pl big-marketing-wheel-types [INFO] Scanning for projects... [INFO] [INFO] --------------- cn.myphoenix:big-marketing-wheel-types --------------- [INFO] Building big-marketing-wheel-types 1.0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) big-marketing-wheel-types --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) big-marketing-wheel-types --- [debug] execute contextualize [INFO] Using UTF-8 encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) big-marketing-wheel-types --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) big-marketing-wheel-types --- [INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) big-marketing-wheel-types --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.291 s [INFO] Finished at: 2024-12-14T15:31:1308:00 [INFO] ------------------------------------------------------------------------由标绿处可以看到既没有重新编译也没有重新打包。说明了情况 1。 注在实际开发场景中我们在 compile、package、install、deploy 时会先执行 clean。 参考 https://www.jb51.net/article/223600.htmhttps://juejin.cn/post/7359083767564238863?searchId202412131535127F99F7999BFA089607E3https://maven.apache.org/guides/mini/guide-multiple-modules.html?spm5176.28103460.0.0.297c5d275vOOxHhttps://juejin.cn/post/7130089666115534855/
http://www.dnsts.com.cn/news/21562.html

相关文章:

  • 做网站开发哪种语言更稳定高效临邑建设局网站
  • 如何在网站上添加qq深圳做分销网站的公司
  • 哪家做网站比较好wordpress镜像是什么意思
  • 成都电子商务网站建设公司网站基础建设
  • 招生网站建设的意义免费公众号模板编辑器
  • h5页面怎么生成链接河南网站seo推广
  • 一键生成100个原创视频百度关键词优化快速排名软件
  • 企业网站制作公司排名电子简历手机版免费
  • 工程建设举报网有哪些网站注册企业邮箱需要什么
  • 聊城手机网站建设公司阿里云域名备案流程详细
  • php网站搬家教程伽师网站建设
  • 视频网站设计苏州模板网站建站
  • 怎么建网站新手入门网站与网页的区别与联系
  • 企业服务网站建设方案上海高端模板建站
  • 国外网站托管桥的设计网站建设
  • 做电影网站赚钱吗适响应式网站弊端
  • 格尔木市建设局网站电商开店流程及费用
  • 汕头网站制作哪家强华为网站建设建议
  • 上海互联网网站建设公司crm系统免费
  • 怎么利用自媒体做网站优化wordpress网站是什么
  • 品牌网站建设还来大蝌蚪网站的功能规范
  • 送网站建设wordpress页脚小工具导航
  • 做360手机网站优化排seo网站源码
  • 企业网站怎么查济南哪个网站建设最好
  • 购物网站设计理念君隆网站建设
  • 自己弄一个网站要多少钱专做hiphop的网站
  • 东莞网上做公司网站常州设计网站
  • h5做招聘网站可以吗温州优化网站
  • 网站网页开发公司如何提高wordpress访问速度
  • 常见的网站建设技术长沙有哪些大型工厂