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

东莞网站关键词优化收费wordpress 调用自定义栏目

东莞网站关键词优化收费,wordpress 调用自定义栏目,免费个人素材网站,为什么需要建设网站本篇涉及到的内容属于神技能#xff0c;多数使用maven的人都经常想要的一种功能#xff0c;但是大多数人都不知道如何使用#xff0c;废话不多说#xff0c;上干货。 需求背景 我们需要做一个电商项目#xff0c;一般都会做成微服务的形式#xff0c;按业务进行划分多数使用maven的人都经常想要的一种功能但是大多数人都不知道如何使用废话不多说上干货。 需求背景 我们需要做一个电商项目一般都会做成微服务的形式按业务进行划分本次我们主要以账户业务和订单业务为例我们将这两块业务分别作为2个大的模块来开发而订单模块又会调用账户模块中的接口所以对账户模块接口部分会有依赖。 我们以maven来搭建项目项目的目录结构如下 b2bb2b-accountb2b-account-apib2b-account-serviceb2b-orderb2b-order-apib2b-order-serviceb2b-account 账户模块其中包含2个小模块b2b-account-api和b2b-account-service b2b-account-api 账户模块对外暴露的接口部分以供外部调用 b2b-account-service 账户模块具体业务实现依赖于b2b-account-api模块 b2b-order 订单模块也是包含2个小模块b2b-order-api和b2b-order-service b2b-order-api 订单模块对外暴露的接口部分以供外部调用 b2b-order-service 订单模块具体业务实现依赖2个模块b2b-order-api、b2b-account-api 搭建项目结构 我们按照上面的需求使用maven搭建项目结构具体过程如下。 创建b2b项目 打开idea点击File-New-Project如下图 选择Maven如下图 点击上图的Next输入坐标信息如下图 点击上图的Next输入Project Name为b2b如下图 点击上图的Finish完成项目的创建如下图 删除下图中无用的代码 变成了下面这样 配置一下idea的maven环境点击File-Settings如下图 点击上面的OK完成配置。 在b2b下创建b2b-account模块 注意这里是创建模块不是项目了注意下面的操作过程。 选中b2b项目目录如下图 点击File-New-Module如下图 选择Maven如下图 点击Next如下图 点击上面第二个...将Parent置为None如下图 输入坐标信息如下图 点击上图中的Next输入Project name为b2b-account如下图 点击Finish完成b2b-account模块的创建如下图 删除b2b-account中src目录如下图 项目结构变成了下面这样 在b2b-account模块下面创建b2b-account-api模块 选中b2b-account如下图 点击File-New-Module如下图 选择Maven如下图 点击上图中的Next如下图 将上面的Add as module to设置为b2b-account模块表示新增的这个模块被b2b-account聚合进行管理。 点击Parent后面的...选择None将Parent对应的值置为None。 如下图 输入坐标信息如下图 点击Next默认如下图 我们需要对上面3个输入框的值进行修改修改成下面这样 点击Finish完成创建如下图 在b2b-account模块下创建b2b-account-service模块 这个过程参考在b2b-account模块下面创建b2b-account-api模块。 在b2b下创建b2b-order模块 这个过程参考在b2b下创建b2b-account模块。 在b2b-order模块下面创建b2b-order-api模块 这个过程参考在b2b-account模块下面创建b2b-account-api模块。 在b2b-order模块下面创建b2b-order-service模块 这个过程参考在b2b-account模块下面创建b2b-account-api模块。 项目结构创建成功 上面都创建成功之后项目结构如下图 参与过大型maven项目开发的是不是很熟悉很亲切多数互联网项目的maven结构就是这样一大片maven模块。 引入项目依赖 b2b-account-service依赖于b2b-account-api模块所以在b2b-account-service/pom.xml中加入下面配置 dependenciesdependencygroupId${project.groupId}/groupIdartifactIdb2b-account-api/artifactIdversion${project.version}/version/dependency /dependencies由于项目的groupId,version都是一样的所以直接通过${}这种方式引用了。 b2b-order-service依赖2个模块b2b-order-api、b2b-account-api所以在b2b-order-service/pom.xml中加入下面配置 dependenciesdependencygroupId${project.groupId}/groupIdartifactIdb2b-account-api/artifactIdversion${project.version}/version/dependencydependencygroupId${project.groupId}/groupIdartifactIdb2b-order-api/artifactIdversion${project.version}/version/dependency /dependencies此时每个模块pom.xml如下 b2b/pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.javacode2018/groupIdartifactIdb2b/artifactIdpackagingpom/packagingversion1.0-SNAPSHOT/versionmodulesmoduleb2b-account/modulemoduleb2b-order/module/modules/projectb2b-account/pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.javacode2018/groupIdartifactIdb2b-account/artifactIdpackagingpom/packagingversion1.0-SNAPSHOT/versionmodulesmoduleb2b-account-api/modulemoduleb2b-account-service/module/modules/projectb2b-account-api/pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.javacode2018/groupIdartifactIdb2b-account-api/artifactIdversion1.0-SNAPSHOT/version/projectb2b-account-service/pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.javacode2018/groupIdartifactIdb2b-account-service/artifactIdversion1.0-SNAPSHOT/versiondependenciesdependencygroupId${project.groupId}/groupIdartifactIdb2b-account-api/artifactIdversion${project.version}/version/dependency/dependencies/projectb2b-order/pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.javacode2018/groupIdartifactIdb2b-order/artifactIdpackagingpom/packagingversion1.0-SNAPSHOT/versionmodulesmoduleb2b-order-api/modulemoduleb2b-order-service/module/modules/projectb2b-order-api/pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.javacode2018/groupIdartifactIdb2b-order-api/artifactIdversion1.0-SNAPSHOT/version/projectb2b-order-service/pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.javacode2018/groupIdartifactIdb2b-order-service/artifactIdversion1.0-SNAPSHOT/versiondependenciesdependencygroupId${project.groupId}/groupIdartifactIdb2b-account-api/artifactIdversion${project.version}/version/dependencydependencygroupId${project.groupId}/groupIdartifactIdb2b-order-api/artifactIdversion${project.version}/version/dependency/dependencies/project注意上面项目的结构属于父子结构使用maven中聚合的方式进行管理的对应聚合不是太了解的可以看上篇文章有详细介绍。 b2b中包含了2个子模块b2b_account和b2b_order这3个package都是pom。 b2b_account中包含了2个子模块2个子模块package是默认的jar类型。 b2b_order中包含了2个子模块2个子模块package是默认的jar类型。 反应堆 上面项目都开发好了我们需要安装到本地仓库一般情况下我们会这么做在b2b/pom.xml所在目录执行下面命令 mvn clean install我们来感受一下这个命令的效果 D:\code\IdeaProjects\b2bmvn clean install [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] b2b-account-api                                                    [jar] [INFO] b2b-account-service                                                [jar] [INFO] b2b-account                                                        [pom] [INFO] b2b-order-api                                                      [jar] [INFO] b2b-order-service                                                  [jar] [INFO] b2b-order                                                          [pom] [INFO] b2b                                                                [pom] [INFO] [INFO] ------------------ com.javacode2018:b2b-account-api ------------------ [INFO] Building b2b-account-api 1.0-SNAPSHOT                              [1/7] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-account-api --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-account-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-account-api --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-account-api --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.pom [INFO] [INFO] ---------------- com.javacode2018:b2b-account-service ---------------- [INFO] Building b2b-account-service 1.0-SNAPSHOT                          [2/7] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-account-service --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-account-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-account-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-account-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-account-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-account-service --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-account-service --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\target\b2b-account-service-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-account-service --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\target\b2b-account-service-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-service\1.0-SNAPSHOT\b2b-account-service-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-service\1.0-SNAPSHOT\b2b-account-service-1.0-SNAPSHOT.pom [INFO] [INFO] -------------------- com.javacode2018:b2b-account -------------------- [INFO] Building b2b-account 1.0-SNAPSHOT                                  [3/7] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-account --- [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-account --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account\1.0-SNAPSHOT\b2b-account-1.0-SNAPSHOT.pom [INFO] [INFO] ------------------- com.javacode2018:b2b-order-api ------------------- [INFO] Building b2b-order-api 1.0-SNAPSHOT                                [4/7] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-order-api --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-order-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-order-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-order-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-order-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-order-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-order-api --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\target\b2b-order-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-order-api --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\target\b2b-order-api-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-api\1.0-SNAPSHOT\b2b-order-api-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-api\1.0-SNAPSHOT\b2b-order-api-1.0-SNAPSHOT.pom [INFO] [INFO] ----------------- com.javacode2018:b2b-order-service ----------------- [INFO] Building b2b-order-service 1.0-SNAPSHOT                            [5/7] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-order-service --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-order-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-order-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-order-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-order-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-order-service --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-order-service --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\target\b2b-order-service-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-order-service --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\target\b2b-order-service-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-service\1.0-SNAPSHOT\b2b-order-service-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-service\1.0-SNAPSHOT\b2b-order-service-1.0-SNAPSHOT.pom [INFO] [INFO] --------------------- com.javacode2018:b2b-order --------------------- [INFO] Building b2b-order 1.0-SNAPSHOT                                    [6/7] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-order --- [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-order --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order\1.0-SNAPSHOT\b2b-order-1.0-SNAPSHOT.pom [INFO] [INFO] ------------------------ com.javacode2018:b2b ------------------------ [INFO] Building b2b 1.0-SNAPSHOT                                          [7/7] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b --- [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b --- [INFO] Installing D:\code\IdeaProjects\b2b\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b\1.0-SNAPSHOT\b2b-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for b2b 1.0-SNAPSHOT: [INFO] [INFO] b2b-account-api .................................... SUCCESS [  1.806 s] [INFO] b2b-account-service ................................ SUCCESS [  0.298 s] [INFO] b2b-account ........................................ SUCCESS [  0.082 s] [INFO] b2b-order-api ...................................... SUCCESS [  0.229 s] [INFO] b2b-order-service .................................. SUCCESS [  0.254 s] [INFO] b2b-order .......................................... SUCCESS [  0.058 s] [INFO] b2b ................................................ SUCCESS [  0.069 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time:  3.072 s [INFO] Finished at: 2019-11-20T16:03:2708:00 [INFO] ------------------------------------------------------------------------注意上面有这样的输出 [INFO] Reactor Build Order: [INFO] [INFO] b2b-account-api                                                    [jar] [INFO] b2b-account-service                                                [jar] [INFO] b2b-account                                                        [pom] [INFO] b2b-order-api                                                      [jar] [INFO] b2b-order-service                                                  [jar] [INFO] b2b-order                                                          [pom] [INFO] b2b                                                                [pom]maven会根据模块之间的依赖关系然后会得到所有模块的构建顺序上面共有7个pom.xml文件也就是7个maven构件按照上面列出的顺序依次进行构建。 可以看到b2b-account-api是被其他一些模块依赖的所以这个放在了第一个。 mvn命令对多模块构件时会根据模块的依赖关系而得到模块的构建顺序这个功能就是maven的反应堆reactor做的事情反应堆会根据模块之间的依赖关系、聚合关系、继承关系等等从而计算得出一个合理的模块构建顺序所以反应堆的功能是相当强大的。 按需随意构建 有这样的一种场景b2b-account-api被b2b-account-service和b2b-order-service依赖了所以当b2b-account-api有修改的时候我们希望他们3个都能够被重新构建一次而不是去对所有的模块都进行重新构建我们只希望被影响的模块都能够参与重新构建大家有什么好的办法 上面列出的只是2个模块的功能真正的电商项目还有很多模块如果每次修改一个模块我们都去重新打包所有的模块这个构建过程耗时是非常久的只能干等着我们需要的是按需构建需要构建哪些模块让我们自己能够随意指定这样也可以加快构建的速度所以我们需要这样的功能 maven反应堆帮我们考虑到了这种情况mvn命令提供了一些功能可以帮我们实现这些操作我们看一下mvn的帮助文档mvn -h可以查看帮助如下 D:\code\IdeaProjects\b2bmvn -husage: mvn [options] [goal(s)] [phase(s)]Options:-am,--also-make                        If project list is specified, alsobuild projects required by thelist-amd,--also-make-dependents            If project list is specified, alsobuild projects that depend onprojects on the list-B,--batch-mode                        Run in non-interactive (batch)mode (disables output color)-b,--builder arg                     The id of the build strategy touse-C,--strict-checksums                  Fail the build if checksums dontmatch-c,--lax-checksums                     Warn if checksums dont match-cpu,--check-plugin-updates            Ineffective, only kept forbackward compatibility-D,--define arg                      Define a system property-e,--errors                            Produce execution error messages-emp,--encrypt-master-password arg   Encrypt master security password-ep,--encrypt-password arg           Encrypt server password-f,--file arg                        Force the use of an alternate POMfile (or directory with pom.xml)-fae,--fail-at-end                     Only fail the build afterwards;allow all non-impacted builds tocontinue-ff,--fail-fast                        Stop at first failure inreactorized builds-fn,--fail-never                       NEVER fail the build, regardlessof project result-gs,--global-settings arg            Alternate path for the globalsettings file-gt,--global-toolchains arg          Alternate path for the globaltoolchains file-h,--help                              Display help information-l,--log-file arg                    Log file where all build outputwill go (disables output color)-llr,--legacy-local-repository         Use Maven 2 Legacy LocalRepository behaviour, ie no use of_remote.repositories. Can also beactivated by using-Dmaven.legacyLocalRepotrue-N,--non-recursive                     Do not recurse into sub-projects-npr,--no-plugin-registry              Ineffective, only kept forbackward compatibility-npu,--no-plugin-updates               Ineffective, only kept forbackward compatibility-nsu,--no-snapshot-updates             Suppress SNAPSHOT updates-ntp,--no-transfer-progress            Do not display transfer progresswhen downloading or uploading-o,--offline                           Work offline-P,--activate-profiles arg           Comma-delimited list of profilesto activate-pl,--projects arg                   Comma-delimited list of specifiedreactor projects to build insteadof all projects. A project can bespecified by [groupId]:artifactIdor by its relative path-q,--quiet                             Quiet output - only show errors-rf,--resume-from arg                Resume reactor from specifiedproject-s,--settings arg                    Alternate path for the usersettings file-t,--toolchains arg                  Alternate path for the usertoolchains file-T,--threads arg                     Thread count, for instance 2.0Cwhere C is core multiplied-U,--update-snapshots                  Forces a check for missingreleases and updated snapshots onremote repositories-up,--update-plugins                   Ineffective, only kept forbackward compatibility-v,--version                           Display version information-V,--show-version                      Display version informationWITHOUT stopping build-X,--debug                             Produce execution debug output上面列出了mvn命令后面的一些选项有几个选项本次我们需要用到如下 -pl,--projects arg 构件指定的模块arg表示多个模块之间用逗号分开模块有两种写法 -pl 模块1相对路径 [,模块2相对路径] [,模块n相对路径] -pl [模块1的groupId]:模块1的artifactId [,[模块2的groupId]:模块2的artifactId] [,[模块n的groupId]:模块n的artifactId]举例 下面命令都是在b2b/pom.xml来运行 mvn clean install -pl b2b-account mvn clean install -pl b2b-account/b2b-account-api mvn clean install -pl b2b-account/b2b-account-api,b2b-account/b2b-account-service mvn clean install -pl :b2b-account-api,b2b-order/b2b-order-api mvn clean install -pl :b2b-account-api,:b2b-order-service-rf,--resume-from arg 从指定的模块恢复反应堆 -am,--also-make 同时构建所列模块的依赖模块 -amd,--also-make-dependents 同时构件依赖于所列模块的模块 下面我们通过6个案例细说上面这些用法。 注意下面所有案例都在b2b/pom.xml所在目录执行。 案例1 只构建p-account模块运行命令 mvn clean install -pl b2b-account效果如下 D:\code\IdeaProjects\b2bmvn clean install -pl b2b-account [INFO] Scanning for projects... [INFO] [INFO] -------------------- com.javacode2018:b2b-account -------------------- [INFO] Building b2b-account 1.0-SNAPSHOT [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-account --- [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-account --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account\1.0-SNAPSHOT\b2b-account-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time:  0.907 s [INFO] Finished at: 2019-11-20T16:12:5108:00 [INFO] ------------------------------------------------------------------------可以看到只构建了b2b-account。 案例2 只构建b2b-account-api模块运行命令 mvn clean install -pl b2b-account/b2b-account-api效果如下 D:\code\IdeaProjects\b2bmvn clean install -pl b2b-account/b2b-account-api [INFO] Scanning for projects... [INFO] [INFO] ------------------ com.javacode2018:b2b-account-api ------------------ [INFO] Building b2b-account-api 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-account-api --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-account-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-account-api --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-account-api --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time:  2.853 s [INFO] Finished at: 2019-11-20T16:14:3708:00 [INFO] ------------------------------------------------------------------------上面使用的是相对路径的写法还有2种写法大家可以去试试如下 mvn clean install -pl :b2b-account-api mvn clean install -pl com.javacode2018:b2b-account-api案例3 构建b2b-account-api和b2b-order-api运行下面命令 mvn clean install -pl b2b-account/b2b-account-api,b2b-order/b2b-order-api效果如下 D:\code\IdeaProjects\b2bmvn clean install -pl b2b-account/b2b-account-api,b2b-order/b2b-order-api [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] b2b-account-api                                                    [jar] [INFO] b2b-order-api                                                      [jar] [INFO] [INFO] ------------------ com.javacode2018:b2b-account-api ------------------ [INFO] Building b2b-account-api 1.0-SNAPSHOT                              [1/2] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-account-api --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-account-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-account-api --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-account-api --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.pom [INFO] [INFO] ------------------- com.javacode2018:b2b-order-api ------------------- [INFO] Building b2b-order-api 1.0-SNAPSHOT                                [2/2] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-order-api --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-order-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-order-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-order-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-order-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-order-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-order-api --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\target\b2b-order-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-order-api --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\target\b2b-order-api-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-api\1.0-SNAPSHOT\b2b-order-api-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-api\1.0-SNAPSHOT\b2b-order-api-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for b2b-account-api 1.0-SNAPSHOT: [INFO] [INFO] b2b-account-api .................................... SUCCESS [  2.874 s] [INFO] b2b-order-api ...................................... SUCCESS [  0.393 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time:  3.554 s [INFO] Finished at: 2019-11-20T16:15:5708:00 [INFO] ------------------------------------------------------------------------上面输出中可以看到只构建了2个目标模块。 案例4 我们只修改了b2b-account-api代码所以我希望对这个重新打包并且对这个有依赖的也重新打包所以需要打包下面3个模块 b2b-account-api b2b-account-service b2b-order-service上面列表中的后面两个是依赖于b2b-account-api的可以在b2b/pom.xml中执行下面命令 mvn clean install -pl b2b-account/b2b-account-api -amd我们看一下效果 D:\code\IdeaProjects\b2bmvn clean install -pl b2b-account/b2b-account-api -amd [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] b2b-account-api                                                    [jar] [INFO] b2b-account-service                                                [jar] [INFO] b2b-order-service                                                  [jar] [INFO] [INFO] ------------------ com.javacode2018:b2b-account-api ------------------ [INFO] Building b2b-account-api 1.0-SNAPSHOT                              [1/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-account-api --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-account-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-account-api --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-account-api --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.pom [INFO] [INFO] ---------------- com.javacode2018:b2b-account-service ---------------- [INFO] Building b2b-account-service 1.0-SNAPSHOT                          [2/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-account-service --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-account-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-account-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-account-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-account-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-account-service --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-account-service --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\target\b2b-account-service-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-account-service --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\target\b2b-account-service-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-service\1.0-SNAPSHOT\b2b-account-service-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-service\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-service\1.0-SNAPSHOT\b2b-account-service-1.0-SNAPSHOT.pom [INFO] [INFO] ----------------- com.javacode2018:b2b-order-service ----------------- [INFO] Building b2b-order-service 1.0-SNAPSHOT                            [3/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-order-service --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-order-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-order-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-order-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-order-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-order-service --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-order-service --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\target\b2b-order-service-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-order-service --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\target\b2b-order-service-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-service\1.0-SNAPSHOT\b2b-order-service-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-service\1.0-SNAPSHOT\b2b-order-service-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for b2b-account-api 1.0-SNAPSHOT: [INFO] [INFO] b2b-account-api .................................... SUCCESS [  2.440 s] [INFO] b2b-account-service ................................ SUCCESS [  0.381 s] [INFO] b2b-order-service .................................. SUCCESS [  0.364 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time:  3.508 s [INFO] Finished at: 2019-11-20T16:05:0008:00 [INFO] ------------------------------------------------------------------------从上面输出中看一下反应堆列出的构建顺序b2b-account-api、b2b-account-service、b2b-order-service。 上面过程给大家捋一捋 上面命令先会运行-pl b2b-account-api得到一个反应堆列表如下只有一个模块 b2b-account-api然后后面又会执行amd这个命令会找到对-pl b2b-account-api有依赖的构件也就是 b2b-account-service b2b-order-serivce然后反应堆会对3个构件进行排序得到一个正确的构件顺序如下 [INFO] Reactor Build Order: [INFO] [INFO] b2b-account-api                                                    [jar] [INFO] b2b-account-service                                                [jar] [INFO] b2b-order-service                                                  [jar]然后maven会依次对他们执行 mvn clean install案例5 需求我们来构建b2b-order-service希望b2b-account-service依赖的构件也能被同时构建b2b-account-service依赖于b2b-account-api和b2b-order-api可能b2b-account-service会依赖的更多。 可以使用下面命令 mvn clean install -pl b2b-order/b2b-order-service -am效果如下 D:\code\IdeaProjects\b2bmvn clean install -pl b2b-order/b2b-order-service -am [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] b2b-account-api                                                    [jar] [INFO] b2b-order-api                                                      [jar] [INFO] b2b-order-service                                                  [jar] [INFO] [INFO] ------------------ com.javacode2018:b2b-account-api ------------------ [INFO] Building b2b-account-api 1.0-SNAPSHOT                              [1/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-account-api --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-account-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-account-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-account-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-account-api --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-account-api --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\target\b2b-account-api-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-account\b2b-account-api\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-account-api\1.0-SNAPSHOT\b2b-account-api-1.0-SNAPSHOT.pom [INFO] [INFO] ------------------- com.javacode2018:b2b-order-api ------------------- [INFO] Building b2b-order-api 1.0-SNAPSHOT                                [2/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-order-api --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-order-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-order-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-order-api --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-order-api --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-order-api --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-order-api --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\target\b2b-order-api-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-order-api --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\target\b2b-order-api-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-api\1.0-SNAPSHOT\b2b-order-api-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-api\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-api\1.0-SNAPSHOT\b2b-order-api-1.0-SNAPSHOT.pom [INFO] [INFO] ----------------- com.javacode2018:b2b-order-service ----------------- [INFO] Building b2b-order-service 1.0-SNAPSHOT                            [3/3] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean)  b2b-order-service --- [INFO] Deleting D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources)  b2b-order-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile)  b2b-order-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)  b2b-order-service --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile)  b2b-order-service --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test)  b2b-order-service --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar)  b2b-order-service --- [INFO] Building jar: D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\target\b2b-order-service-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install)  b2b-order-service --- [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\target\b2b-order-service-1.0-SNAPSHOT.jar to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-service\1.0-SNAPSHOT\b2b-order-service-1.0-SNAPSHOT.jar [INFO] Installing D:\code\IdeaProjects\b2b\b2b-order\b2b-order-service\pom.xml to C:\Users\Think\.m2\repository\com\javacode2018\b2b-order-service\1.0-SNAPSHOT\b2b-order-service-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for b2b-account-api 1.0-SNAPSHOT: [INFO] [INFO] b2b-account-api .................................... SUCCESS [  2.509 s] [INFO] b2b-order-api ...................................... SUCCESS [  0.343 s] [INFO] b2b-order-service .................................. SUCCESS [  0.340 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time:  3.455 s [INFO] Finished at: 2019-11-20T16:46:4508:00 [INFO] ------------------------------------------------------------------------从上面输出中看一下反应堆列出的构建顺序b2b-account-api、b2b-order-api、b2b-order-service。 上面过程给大家捋一捋 上面命令先会运行-pl b2b-order-service得到一个反应堆列表 b2b-order-service然后后面又会执行am这个命令会找到-pl b2b-order-service依赖的构件也就是 b2b-account-api b2b-order-api然后反应堆会对3个构件进行排序得到一个正确的构件顺序如下 [INFO] Reactor Build Order: [INFO] [INFO] b2b-account-api                                                    [jar] [INFO] b2b-order-api                                                      [jar] [INFO] b2b-order-service                                                  [jar]然后maven会依次对他们执行 mvn clean install案例6 分别执行下面2条mvn命令先看一下效果 mvn clean install mvn clean install -rf b2b-order/b2b-order-service输出中我们取出部分内容如下。 第一条命令反应堆产生的构建顺序是 [INFO] Reactor Build Order: [INFO] [INFO] b2b-account-api                                                    [jar] [INFO] b2b-account-service                                                [jar] [INFO] b2b-account                                                        [pom] [INFO] b2b-order-api                                                      [jar] [INFO] b2b-order-service                                                  [jar] [INFO] b2b-order                                                          [pom] [INFO] b2b                                                                [pom]第2条命令反应堆产生的构建顺序是 [INFO] Reactor Build Order: [INFO] [INFO] b2b-order-service                                                  [jar] [INFO] b2b-order                                                          [pom] [INFO] b2b                                                                [pom]在仔细看一下上面2条命令的差别后面的命令多了-rf b2b-order/b2b-order-service具体过程如下 会先执行下面命令 mvn clean install反应堆会计算出需要构件的模块顺序如下 [INFO] Reactor Build Order: [INFO] [INFO] b2b-account-api                                                    [jar] [INFO] b2b-account-service                                                [jar] [INFO] b2b-account                                                        [pom] [INFO] b2b-order-api                                                      [jar] [INFO] b2b-order-service                                                  [jar] [INFO] b2b-order                                                          [pom] [INFO] b2b                                                                [pom]-rf b2b-order/b2b-order-service对上面的反应堆构件顺序进行裁剪将b2b-order/b2b-order-service前面的部分干掉从b2b-order/b2b-order-service开始执行构建操作所以剩下了3个需要构建的模块。 总结 需要掌握mvn命令中-pl、-am、-amd、-rf的各种用法 注意-pl后面的参数的写法模块相对路径、或者[groupId].artifactId 还是那句话上面这些用法大家会经常用到的建议大家下去了多练练。看和操作所获取到的是不能比的看的过程中可能觉得一切都知道了但是实际操作就不一样了可能中间会遇到各种问题然后自己会想办法解决这些问题领会和学到的东西是不一样的
http://www.ho-use.cn/article/10818901.html

相关文章:

  • 洛阳专业做网站多少钱wordpress grid
  • 100个有趣的网站浏览器无法访问wordpress报503
  • 成都高新区建设厅网站天津西青网站建设公司
  • 做网站绑定域名 解析域名山东农业工程学院教务网络管理系统
  • 海关年检要去哪个网站上做网上营销新观察网
  • 深圳品牌网站建设服务建造自己的网站
  • 网站静态和动态那个好徐州建设工程交易平台
  • 个人网站内容如何填写网站设计深圳市
  • 网站申请微信登录wordpress浮动小人
  • 可以做网站首页的图片哮喘病应该怎样治除根
  • 新乡做新网站wordpress 添加固定字段
  • 个人网站效果东莞建设网站综合服务平台
  • 梅江区住房和城乡建设局官方网站织梦做的网站快照被攻击
  • 浙江省建设厅网站在哪里ui设计简介
  • 泉州关键词网站排名怎么做网站界面设计
  • 制作网站品牌公司wordpress. xss
  • 深圳做app网站设计平面设计接单的网站
  • 凡客家具seo引擎优化专员
  • 自己做的网站网页打开速度慢学校网站建设渠道
  • 泸州工投建设集团网站给企业做网络推广工作怎么样
  • 做网站除了有服务器还需要什么软件成都哪里做网站
  • 网站 邮件系统建设招标做教育的需要做个网站吗
  • 网站横幅代码制作网站的网页
  • 网站做专题免费源码资源分享网
  • 青岛做一个网站多少钱开发平台多少钱
  • 广州刚刚通报优化网站排名推广
  • 南宁专业网站制作西双版纳傣族自治州勐海县
  • 自学做网站需要学会哪些最新新闻热点事件及评论
  • 做网站用的一些素材网站建设哪家较好
  • 上海网站建设优化wordpress给分页加链接