首先,准备好打包好的maven 打包好的springboot的jar文件
1、先从git上(https://github.com/kohsuke/winsw/releases)下载图中标出的文件
2、 新建一个xml文件,配置服务注册信息,写入以下内容:
<?xml version="1.0" encoding="UTF-8"?> <service> <!--服务ID--> <id>Unique windows service ID</id> <!--服务名--> <name>xxx</name> <!--服务描述--> <description>xxx</description> <!--运行方式--> <executable>java</executable> <!--执行参数--> <arguments>-jar "xxx.jar"</arguments> <!-- 日志配置 --> <logpath>.\logs</logpath> <!--日志重置 (rotate循环追加)--> <logmode>reset</logmode> </service>
3、服务安装:使用cmd,用cd命令转到下载的exe文件所在文件夹,然后执行命令
安装服务命令:WinSW.NET4.exe install
卸载服务命令:WinSW.NET4.exe uninstall
done