Spring Boot项目部署(Linux、maven)

Spring Boot部署

环境linux, 基于maven, 打包成jar

1.在pom.xml中添加插件

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <executable>true</executable>
    </configuration>
</plugin>
  • <executable>true</executable>会给最后生成的jar加上shell脚本。

    1. 打包
mvn clean install spring-boot:repackage -U

3.上传到linux服务器
可以给一下权限

chmod 775 xxx.jar

4.创建连接 (使用命令时,一定要在根目录下)

sudo ln -s /xxx/xxx/你的打包名.jar /etc/init.d/自定义名

5.运行、停止、重启服务 start|stop|restart

sudo service 上面你的自定义名 start

猜你喜欢

转载自blog.csdn.net/sweatott/article/details/75270705