1.用gradle把springboot项目打包成jar

1.1 build.gradle 中添加

buildscript {
repositories {
mavenLocal()
maven { url "http://*.*.*.*:*/nexus/content/groups/public/" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE")
}
} apply plugin: 'java'
apply plugin: 'org.springframework.boot'

注意:apply plugin: 'war' //这一行不要加,否则很有可能打不了jar包,只能打出来war包

1.2 执行构建命令

 gradle bootRepackage

2.打印日志,利用shell启动并配置log日志

2.1 启动项目

#!/bin/bash
echo starting...
java -jar topca-storage-srv-1.0.0.jar > log.file 2>log.error &

2.2 停止正在运行的项目

#!/bin/bash
PID=$(ps -ef | grep topca-storage-srv-1.0.0.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
echo Application is already stopped
else
echo kill $PID
kill $PID
fi

2.3 重启项目

#!/bin/bash
echo stop application ...
source stop.sh
echo start application ...
source start.sh

gradle结合spring-boot生成可运行jar包,并打印日志的更多相关文章

  1. 精尽Spring Boot源码分析 - Jar 包的启动实现

    该系列文章是笔者在学习 Spring Boot 过程中总结下来的,里面涉及到相关源码,可能对读者不太友好,请结合我的源码注释 Spring Boot 源码分析 GitHub 地址 进行阅读 Sprin ...

  2. spring boot开发为什么使用jar包

    spring boot既可以打成war发布,也可以找成jar包发布. jar包:直接通过内置tomcat运行,不需要额外安装tomcat.如需修改内置tomcat的配置,只需要在spring boot ...

  3. spring boot + jersey工程由jar包转为war包在tomcat中启动报错问题

    第一步: 在maven下,将Spring Boot工程由jar转换为war包启动,很简单,将pom.xml文件中的packaging改为war <packaging>war</pac ...

  4. IDEA 快速将spring boot项目打包成jar包,简单快速有效

    原文地址;https://blog.csdn.net/chen846262292/article/details/80701101  https://www.cnblogs.com/chrischen ...

  5. 让maven生成可运行jar包

    平时项目大多用到的是war包,今天实现了一个简单功能,无需部署到web服务器上,只需本地跑java代码即可,因此只要生成一个jar包.那么怎么让maven项目打成一个可以使用java命令跑的jar包呢 ...

  6. spring boot编译项目打jar包

    <build> <plugins> <!--jar包打包--> <plugin> <groupId>org.springframework. ...

  7. IDEA 对spring boot Maven 项目打 Jar 包

    <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> ...

  8. spring boot maven打包可运行jar包

    普通打包之后在程序目录运行,或者编写bat运行时会提示“没有主清单属性”,这是因为并没有找到main()方法,需要我们指明告诉java程序 我bat中的代码 @echo off title mytit ...

  9. 【Maven学习】Maven打包生成普通jar包、可运行jar包、包含所有依赖的jar包

    http://blog.csdn.net/u013177446/article/details/54134394 ******************************************* ...

随机推荐

  1. Nginx反向代理实现会话(session)保持的两种方式 (转)

    http://blog.csdn.net/gaoqiao1988/article/details/53390352 一.ip_hash: ip_hash使用源地址哈希算法,将同一客户端的请求总是发往同 ...

  2. 异常空格,ASCII (194,160)问题

    今天运营的同学反映有一些店铺的名称后面带空格,我下意识的说不可能啊,我已经处理过了啊.然后就找出来看. 其中有个店铺的名称是“安踏 ”,第一眼看上去好像是带了个空格.然后我就仔细的看了下. pry(m ...

  3. < Python Index >

    1. 基本语法   1.1 常量/变量   1.2 运算符   1.3 表达式   1.4 程序结构 2. 内置数据结构    2.1 列表    2.2 元组    2.3 集合    2.4 st ...

  4. Node.js进程管理之进程集群

    一.cluster模块 Node.js是单线程处理,对于高并发的请求怎么样能增加吞吐量呢?为了提高服务器的利用率,能不能多核的来处理呢?于是就有了cluster模块. cluster模块可以轻松实现运 ...

  5. java date相关

    public static void getPreDay() throws ParseException{     String dateStr="2013-1-1";     D ...

  6. [转]ASP.NET Core 指定环境发布(hosting environment)

    本文转自:https://www.cnblogs.com/xishuai/p/asp-net-core-set-hosting-environment-with-publish.html ASP.NE ...

  7. jQuery操作<input type="radio">

    input type="radio">如下: <input type="radio" name="city" value=&qu ...

  8. jquery select change下拉框选项变化判断选中值

    <th class="formTitle"> 是否转出: </th> <td class="formValue" colspan= ...

  9. css3 animation(动画)笔记

    在开始介绍Animation之前我们有必要先来了解一个特殊的东西,那就是"Keyframes",我们把他叫做“关键帧”,玩过flash的朋友可能对这个东西并不会陌生.下面我们就一起 ...

  10. [javaSE] 数组(排序-选择排序)

    两层嵌套循环,外层循环控制次数,内层循环进行比较 for(int x=0;x<arr.length;x++){ for(int y=0;y<arr.length;y++){ if(arr[ ...