jenkins部署springboot多项目
war包的部署问题不大,这里记录jar包的部署过程:
1:jar包的体积过大问题
pom.xml参考以下配置(依赖包会分离到target/lib/,jar包体积由几十M缩小到几k)
<build>
<plugins> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.ylcloud.admin.AdminWebApplication</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin> </plugins>
</build>
2:
对各个项目的分离出来的lib要做一下整合,然后上传到服务器启动类的根目录(要注意的是一般项目架构定了之后lib包基本是没什么改动的,只有个别模块的依赖包会持续更新,后续在jenkins的post step传上去就可以了)
3:
结合shell进行自动部署,主要是3个脚本,这里只做一下工作记录:
第一个是进程结束脚本:
#!/bin/bash
echo "Stopping SpringBoot Application for CMP"
#ls
pid=`ps -ef | grep $* | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then kill - $pid
else echo "no pid"
fi echo "run end"
第二个是项目监控脚本(保证项目按顺序执行)
#!/bin/bash
echo "start script ................" file=$ while [ -f $file ]
do
echo "find log ........."
result=`grep "启动成功" $file`
if [[ "$result" != "" ]]
then
echo "springboot start ........."
break
else
echo "running ......."
sleep 1s
fi
done
echo "springboot Started..........."
第三个是项目启动脚本:
#!/bin/bash
source /etc/profile jarversion='-0.0.1-SNAPSHOT.jar'
basepath='/cjh/yl_cloud/' runjar(){ sh test.sh $ nohup java -jar $ $$jarversion > $basepath$ & >& & sh tt.sh $basepath$ echo $ } runjar 'ylcloud-customer-service' 'nohup.out' '核心模块启动完成' '-Xms10m -Xmx500m' echo '项目启动成功'
转载请注明博客出处:http://www.cnblogs.com/cjh-notes/
jenkins部署springboot多项目的更多相关文章
- 使用Jenkins部署Spring Boot项目
jenkins是devops神器,本篇文章介绍如何安装和使用jenkins部署Spring Boot项目 jenkins搭建 部署分为三个步骤: 第一步,jenkins安装 第二步,插件安装和配置 第 ...
- jenkins+windows+springboot+.net项目自动化部署图文教程
之前一直在linux中使用jenkins部署程序,正好现在的项目包括了winfrom程序,所以需要部署到windows系统中 jenkins官网:https://jenkins.io/ 下载之后运行j ...
- 五. jenkins部署springboot项目(2)--windows环境--服务
前提:jenkins和springboot运行在同一台机器 springboot 通过winsw部署为服务 winsw 下载地址:https://github.com/kohsuke/winsw/re ...
- Jenkins部署springboot项目
记录jenkins如何部署springboot项目(jar类型的) 一.首先需要先配置好jenkins的基本配置(jdk.maven--),可在系统管理-->>全局工具配置中进行配置. 配 ...
- 四. jenkins部署springboot项目(1)--window环境
前提:jenkins和springboot运行在同一台机器 springboot项目使用git和maven jenkins所需的插件如Maven,Git等这里就不再详述. 1.jenkins配置git ...
- Jenkins部署git+python项目实现持续集成
目录 1. 创建 item 2. 配置 3. 构建 1. 创建 item 接下来填写创建任务的名字,并选择创建一个 Freestyle project ,点击确认. 2. 配置 接下来进入到项目相关配 ...
- 七. jenkins部署springboot项目(4)-linux环境--远程调试
前提:linux环境,jenkins服务器和springboot服务器不在一台机器. linux环境,jenkins这里就不说了,主要说下和windows环境的不同. 1. jenkins服务器连接s ...
- 六. jenkins部署springboot项目(3)--windows环境--远程windows server服务器
前提:jenkins服务器和windows server服务器不在一台机器上 对于jenkins服务器上编译好的jar或war包如何推送到windows server服务器上. 参照网上的,在wind ...
- 物联网架构成长之路(15)-Jenkins部署SpringBoot
1.前言 现在慢慢也在负责一些工作了.这段时间有空,就多了解了解软件多人开发的一些知识.以前项目都是我一个人做的,从数据库设计到后端再到前端,全部放在一个war包丢到tomcat里面然后运行,利用to ...
随机推荐
- Qt——事件
1.常见事件 [1]鼠标事件 (1)坐标 x(),y(), 相对windows globalX() globalY() (2)获得点击 button() [2]键盘事件 [3]定时器事件 timerI ...
- Codecraft-18 and Codeforces Round #458:D,Bash and a Tough Math Puzzle
题目传送门 题目大意:Bash喜欢对数列进行操作.第一种操作是询问l~r区间内的gcd值是否几乎为x,几乎为表示能否至多修改一个数达到.第二种操作是将ai修改为x.总共Q个询问,N个数. Soluti ...
- Windows Server 2008 R2 安装域
在Windows Server 2008 R2里面安装域. 1.首先在"服务"里面添加"角色": 2.选择对应的域角色 3.安装完成后要启动配置向导 4.选择新 ...
- hdu1869六度分离(floyd)
六度分离 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- Appium Inspector定位元素与录制简单脚本
本次以微信为例, 使用Appium自带的Inspector定位工具定位元素, 以及进行最最最简单脚本的录制: capabilities = { "platformName": &q ...
- 前端开发工程师 - 01.页面制作 - 第3章.HTML
第3章--HTML HTML简介 Hyper Text Markup Language:超文本标记语言--用于标记网页的内容 history: html(1991)雏形 -> html4.01( ...
- 深入理解java虚拟机学习笔记(一)
第二章 Java内存区域与内存溢出异常 运行时数据区域 程序计数器(Program Counter Register) 程序计数器:当前线程所执行的字节码行号指示器.各条线程之间计数器互不影响,独立存 ...
- 干货来袭:Redis5.0支持的新功能说明
Redis5.0支持的新特性说明 本文内容来自华为云帮助中心 华为云DCS的Redis5.x版本继承了4.x版本的所有功能增强以及新的命令,同时还兼容开源Redis5.x版本的新增特性. Stream ...
- Map Reduce Application(Top 10 IDs base on their value)
Top 10 IDs base on their value First , we need to set the reduce to 1. For each map task, it is not ...
- asp.net mvc5 模式的现象思考
.net mv5简化了一些应用逻辑,与其说是mvc架构模式,不如说应用.net Entity更好. 现在你只需要去随便创建一个类 相关数据 然后用一个类去继承 DbContext 定义一个 DbSet ...