通过jpack-maven-plugin 插件可实现Windows、Linux环境打包部署
<plugins>
<!-- 引入 jpack-maven-plugin 插件 https://github.com/blinkfox/jpack-maven-plugin -->
<plugin>
<groupId>com.blinkfox</groupId>
<artifactId>jpack-maven-plugin</artifactId>
<version>1.5.5</version>
<configuration>
<platforms>
<param>Windows</param>
<param>Linux</param>
<!-- <param>Docker</param> -->
</platforms>
<!-- 以下是仅对 Windows 平台下生效的配置项。 -->
<windows>
<vmOptions>-Dfile.encoding=utf-8 -Xms512m -Xmx2048m</vmOptions>
<programArgs></programArgs>
<generateBinDir>true</generateBinDir>
<configFiles>
<param>target/classes/application.yml</param>
</configFiles>
<excludeFiles>
<param>logs</param>
</excludeFiles>
</windows>
</configuration>
</plugin>
</plugins>
找到maven然后双击运行
zip后缀的文件是部署在Windows系统上、gz后缀文件是部署在Linux系统上
最后Windows系统上可通过nssm注册成Windows服务