springboot项目,直接打包成jar
自带tomcat,可以通过java命令直接运行,无需web应用服务.
以maven为例,在pom.xml中配置打包输出类型:
jar
配置build:
org.springframework.boot
spring-boot-maven-plugin
打包成jar后,可以通过批处理直接启动或者停止.
window-bat
start:
@echo off
:wmic process where "commandline like ‘%%-jar reportcheck%%‘" call terminate
set path=C:\Program Files\Java\jre1.8.0_91\binSTART "reportcheck" "%path%\javaw" -jar reportcheck-0.0.1-SNAPSHOT.jar
pause
stop:
@echo off
wmic process where "commandline like ‘%%-jar reportcheck%%‘" call terminate
pause
unix-sh
start:
#!/bin/bash
if ps aux | grep -v ‘grep‘ | grep ‘java‘ | grep ‘reportcheck.jar‘
then
pid=$(ps aux | grep -v ‘grep‘ |grep ‘java‘|grep ‘reportcheck.jar‘| awk ‘{print $2}‘);
echo pid;