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/

最新文章

  1. 纯C#实现屏幕指定区域截屏
  2. goim 及时消息 集成
  3. iscroll修改
  4. Activiti 查看流程图
  5. Linux下Hadoop的简单安装
  6. 【CodeForces】【148D】Bag of mice
  7. mk文件剖析
  8. 用crontab、crond在嵌入式系统中添加定时任务
  9. 无限循环的ViewPager
  10. leetcode Contains Duplicate python
  11. 变化Android系统属性SystemProperties.set(&amp;quot;sys.powerctl&amp;quot;, &amp;quot;shutdown&amp;quot;)关机分析
  12. CubieBoard开发板数据源介绍
  13. 说说Java代理模式
  14. C语言pow()函数的计算精度问题
  15. MobileForm控件的使用方式-用.NET(C#)开发APP的学习日志
  16. js监听用户思否在当前页面
  17. LVS详细介绍以及遇到的坑
  18. 洛谷3703 [SDOI2017] 树点染色 【LCT】【线段树】
  19. mySQL 判断表是否存
  20. JavaWeb开发之详解Servlet及Servlet容器

热门文章

  1. 《JQuery常用插件教程》系列分享专栏
  2. java 写一个单例设计程序,打印出该对象的地址
  3. HyperLedger Fabric 1.4 单机单节点部署(10.2)
  4. 【POJ2182】Lost Cows
  5. Python:numpy中的tile函数
  6. C#原型模式
  7. MySQL日期、字符串、时间戳互转
  8. Python-S9——Day82-CRM项目实战
  9. spring入门(Ioc的理解)
  10. spark集群安装部署