2018-11-30

Springboot maven项目打包发布到远程服务器流程:

1.配置pom环境

        dev

            true

            dev

        test

            test

        prod

            prod

            org.springframework.boot

            spring-boot-maven-plugin

            1.5.12.RELEASE

2.配置application.properties文件

server.servlet.context-path=/sdkback

spring.jackson.date-format=yyyy-MM-dd HH:mm:ss

spring.jackson.time-zone=GMT+8

[email protected]@

3.配置application.yml文件

spring:

profiles:

    active: dev

datasource:

    driver-class-name: com.mysql.jdbc.Driver

    url: jdbc:mysql://?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8

username:

password:

jpa:

hibernate:

      ddl-auto: update

    show-sql: true

#开发环境

---

spring:

  profiles: dev

datasource:

    driver-class-name: com.mysql.jdbc.Driver

    url: jdbc:mysql:=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8

username: 

password:

server:

  port: 8080

#测试环境

---

spring:

  profiles: test

datasource:

    driver-class-name: com.mysql.jdbc.Driver

    url: ?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8

username: 

password: 

server:

  port: 8081

#生产环境

---

spring:

  profiles: prod

datasource:

    driver-class-name: com.mysql.jdbc.Driver

    url: jdbc:mysql://useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8

username:

password: 

server:

  port: 8088

对应打包命令:mvn clean package -Dmaven.test.skip=true -Pprod----生产环境

对应打包命令:mvn clean package -Dmaven.test.skip=true -Ptest----测试环境

对应打包命令:mvn clean package -Dmaven.test.skip=true -Pdev----开发环境

部署方式,windows本地---java -jar +打包成的jar包或者war包

在;linux或ubuntu服务器-----放到tomcat的webapps下重启tomcat

你可能感兴趣的:(2018-11-30)