Jenkins部署SpringCloud微服务项目子模块Springboot单独部署方案

1. 微服务项目单独部署子模块过程中遇到的坑

找不到服务模块

[ERROR] Could not find the selected project in the reactor: xxxServer @ [ERROR] Could not find the selected project in the reactor: xxxServer -> [Help 1]

没有对应的依赖(私服中找不到)

[ERROR] Failed to execute goal on project xxxServer: Could not resolve dependencies for project com.***:xxx1:jar:3.3: The following artifacts could not be resolved: com.**:依赖的模块1:jar:3.3  in maven-zj (http://ip:port/repository/maven-public/) -> [Help 1]
[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.

查了很多方法,很多描述的都不够准确,也没能解决问题,主要问题是项目中maven打包命令配置错误

2. 在jenkins对应的Maven项目中配置配置如下

Jenkins部署SpringCloud微服务项目子模块Springboot单独部署方案_第1张图片

// 说明:
// 1. Root POM : pom.xml 文件为项目【根目录】下的文件,而不是某个子模块
// 2. 打包命令如下:
package -pl 子模块文件夹/子模块名称 -am -DskipTests

3. maven相关命令说明

参数 全称 释义 说明
-pl –projects –projects Build specified reactor projects instead of all projects 选项后可跟随{groupId}:{artifactId}或者所选模块的相对路径(多个模块以逗号分隔)
-am –also-make If project list is specified, also build projects required by the list 表示同时处理选定模块所依赖的模块
-amd –also-make-dependents If project list is specified, also build projects that depend on projects on the list 表示同时处理依赖选定模块的模块
-N –Non-recursive Build projects without recursive 表示不递归子模块
-rf –resume-from Resume reactor from specified project 表示从指定模块开始继续处理
-DskipTests 跳过测试
参考:
https://www.cnblogs.com/sandyflower/p/11600108.html
https://blog.csdn.net/u011662047/article/details/85116163

你可能感兴趣的:(jenkins,springcloud,springboot)