jenkins自动化部署springboot+vue

Plain 复制代码
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins

注意,打开浏览器访问服务器8080端口进行配置时,需要使用ip地址访问。

由于网络问题插件可能部分安装失败,跳过初始化手动下载上传。

在插件管理页面中下载publish by ssh ,maven integration,git plugin,nodejs插件。

通过ssh可以在服务器执行脚本,传送构建完的jar包等资源,通过maven integration可以连接到本地的maven进行项目打包,通过git plugin可以连接到git仓库,进行拉取资源等操作。

同理,如果需要构建vue项目,需要下载node插件。

环境配置

本文使用mac homebrew安装,默认安装路径都位于**/usr/local/Cellar/下。配置如下**

jdk

git

maven

node

配置服务器ssh连接密钥

在系统管理中配置ssh

remote directory为ssh连接后默认进入的文件夹

点击test configuration后显示success即可。

创建项目

在新建任务中构建一个maven项目

配置如下字段

构建触发器

x\]Build whenever a SNAPSHOT dependency is built 构建环境 在构建日志中添加时间戳前缀 ![外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传](https://file.jishuzhan.net/article/1771450783968006146/9f1bfcd296ef8d69ec8cec165de590e6.webp) pom为拉取下来的git项目中的相对地址 ![外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传](https://file.jishuzhan.net/article/1771450783968006146/60e3fb2d6d87cbbb7edf85cbf7bd65d1.webp) source files相对于工作空间的地址,指向需要传输到服务器的文件所在文件夹 ![外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传](https://file.jishuzhan.net/article/1771450783968006146/634949124b1e9f049b75fb904bda4e04.webp) 在exclude files中选择所有的jar文件进行传输。 创建完后运行即可。 遇到的问题 1.插件安装失败 大概率是网络问题,可以在插件面板查找后手动下载上传安装。 2.20:58:55 ERROR: No such file /Users/yaoyitong/.jenkins/workspace/photo-manage/pom.xml 20:58:55 Perhaps you need to specify the correct POM file path in the project configuration? pom路径不正确 3.21:27:39 SSH: Disconnecting configuration \[tencent\] ... 21:27:39 ERROR: Exception when publishing, exception message \[Exec timed out or was interrupted after 120,074 ms

21:27:39 Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE

运行超时,可能原因有你上传文件的路径不正确,或运行脚本编写不正确,服务器停留在脚本运行状态,jenkins没有反馈。

3.[SSH: Transferred 0 file(s)](SSH: Transferred 0 file(s))

上传文件的路径不正确

相关推荐
Olrookie26 分钟前
XXL-JOB GLUE模式动态数据源实践:Spring AOP + MyBatis 解耦多库查询
java·数据库·spring boot
waynaqua31 分钟前
SpringBoot:听说你还不知道时区设置
spring boot
又是努力搬砖的一年1 小时前
SpringBoot中,接口加解密
java·spring boot·后端
芥子沫1 小时前
Jenkins常见问题及解决方法
windows·https·jenkins
风象南1 小时前
SpringBoot 自研运行时 SQL 调用树,3 分钟定位慢 SQL!
spring boot·后端
Q_Q5110082855 小时前
python的软件工程与项目管理课程组学习系统
spring boot·python·django·flask·node.js·php·软件工程
Dontla5 小时前
Makefile介绍(Makefile教程)(C/C++编译构建、自动化构建工具)
c语言·c++·自动化
2301_793086876 小时前
SpringCloud 02 服务治理 Nacos
java·spring boot·spring cloud
MacroZheng7 小时前
还在用WebSocket实现即时通讯?试试MQTT吧,真香!
java·spring boot·后端
是小崔啊7 小时前
【Jenkins】01 - Jenkins安装
运维·jenkins