流程
Jenkins运行环境
Jenkins Version | maven | JDK | centos |
---|---|---|---|
2.418 | 3.8 | 11 | 7.9 |
war包运行环境
tomcat | JDK | centos |
---|---|---|
9 | 17 | 7.9 |
Jenkins配置
- 全局配置
- maven配置参考
- SSH Server配置
- 项目配置 New Item
- 选择构建Maven
- 其它配置参
- ‘**SSH Publishers’ 配置页面找不到? **在最下面点击 ‘Add post-build action’ 按钮, 选择Send build artifacts over SSH,就可以添加 ‘**SSH Publishers’ **配置页面; 点击 **‘Console output (build log) parsing’**添加日志输出配置,需要提前配置.
- 构建运行
效果
问题
可能出现 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ruoyi-common: Fatal error compiling: error: invalid target release: 17 -> [Help 1] 这是因为pom配置的java.version 版本和jenkins运行的JDK版本不一致导致的; 这里就是pom配置的jdk17 jenkins运行环境运行的是jdk11 版本不一致; 打包编译用的jdk11版本,不影响war运行在JDK17的服务器上.