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多项目的更多相关文章

  1. 使用Jenkins部署Spring Boot项目

    jenkins是devops神器,本篇文章介绍如何安装和使用jenkins部署Spring Boot项目 jenkins搭建 部署分为三个步骤: 第一步,jenkins安装 第二步,插件安装和配置 第 ...

  2. jenkins+windows+springboot+.net项目自动化部署图文教程

    之前一直在linux中使用jenkins部署程序,正好现在的项目包括了winfrom程序,所以需要部署到windows系统中 jenkins官网:https://jenkins.io/ 下载之后运行j ...

  3. 五. jenkins部署springboot项目(2)--windows环境--服务

    前提:jenkins和springboot运行在同一台机器 springboot 通过winsw部署为服务 winsw 下载地址:https://github.com/kohsuke/winsw/re ...

  4. Jenkins部署springboot项目

    记录jenkins如何部署springboot项目(jar类型的) 一.首先需要先配置好jenkins的基本配置(jdk.maven--),可在系统管理-->>全局工具配置中进行配置. 配 ...

  5. 四. jenkins部署springboot项目(1)--window环境

    前提:jenkins和springboot运行在同一台机器 springboot项目使用git和maven jenkins所需的插件如Maven,Git等这里就不再详述. 1.jenkins配置git ...

  6. Jenkins部署git+python项目实现持续集成

    目录 1. 创建 item 2. 配置 3. 构建 1. 创建 item 接下来填写创建任务的名字,并选择创建一个 Freestyle project ,点击确认. 2. 配置 接下来进入到项目相关配 ...

  7. 七. jenkins部署springboot项目(4)-linux环境--远程调试

    前提:linux环境,jenkins服务器和springboot服务器不在一台机器. linux环境,jenkins这里就不说了,主要说下和windows环境的不同. 1. jenkins服务器连接s ...

  8. 六. jenkins部署springboot项目(3)--windows环境--远程windows server服务器

    前提:jenkins服务器和windows server服务器不在一台机器上 对于jenkins服务器上编译好的jar或war包如何推送到windows server服务器上. 参照网上的,在wind ...

  9. 物联网架构成长之路(15)-Jenkins部署SpringBoot

    1.前言 现在慢慢也在负责一些工作了.这段时间有空,就多了解了解软件多人开发的一些知识.以前项目都是我一个人做的,从数据库设计到后端再到前端,全部放在一个war包丢到tomcat里面然后运行,利用to ...

随机推荐

  1. cocos2d中锚点概念

    这两天看了下锚点的概念. /** * Sets the anchor point in percent. * * anchorPoint is the point around which all t ...

  2. (数据科学学习手札46)Scala中的面向对象

    一.简介 在Scala看来,一切皆是对象,对象是Scala的核心,Scala面向对象涉及到class.object.构造器等,本文就将对class中的重点内容进行介绍: 二.Scala中的类 2.1 ...

  3. 西安Uber优步司机奖励政策(8月10日到8月16日)

    1) 工作日(周一到周五)早高峰时间段(7点到9:30点).晚高峰时间段(5点到8点)车费 2.0 倍,每单奖励部分上限35元 例:在高峰时段中,假设行程基本车费为¥15,只要达到奖励前提,最后你将获 ...

  4. 厦门Uber优步司机奖励政策(12月28日到1月3日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  5. 机器学习实战:决策树的存储读写文件报错(Python3)

    错误原因:pickle模块存储的是二进制字节码,需要以二进制的方式进行读写 1. 报错一:TypeError: write() argument must be str, not bytes 将决策树 ...

  6. C#从Gif中提取图片

    C#从Gif中提取图片的代码片段 private void btn_extract_Click(object sender, EventArgs e) { Image imgGif = Image.F ...

  7. create-react-app创建react项目 css模块化处理

    用的css预处理器用sass,其他大同小异. 用create-react-app创建项目,执行npm run eject弹出配置文件(此操作不可逆): 配置sass,用的最新的CRA,webpack4 ...

  8. editText设置最大长度

    xml中可以设置为: <EditText android:layout_width = "fill_parent" android:layout_height = " ...

  9. linux-centos6①

  10. cf#516C. Oh Those Palindromes(最多回文子串的字符串排列方式,字典序)

    http://codeforces.com/contest/1064/problem/C 题意:给出一个字符串,要求重新排列这个字符串,是他的回文子串数量最多并输出这个字符串. 题解:字典序排列的字符 ...