• springboot多环境打包


     1 配置文件如图

    2 application.yml  写一些公共的配置文件

    server:
    port: 8090
    spring:
    profiles:
    active: @profile.active@


    3修改pom。xml

    <profiles>
    <profile>
    <id>dev</id>
    <activation>
    <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
    <profile.active>dev</profile.active>
    </properties>
    </profile>
    <profile>
    <id>test</id>
    <properties>
    <profile.active>test</profile.active>
    </properties>
    </profile>
    <profile>
    <id>online</id>
    <properties>
    <profile.active>online</profile.active>
    </properties>
    </profile>
    </profiles>



    <build>
    <finalName>dih-server</finalName>

    <resources>
    <resource>
    <filtering>true</filtering>
    <directory>src/main/</directory>
    <!-- 此配置不可缺,否则mybatis的Mapper.xml将会丢失 -->
    <includes>
    <include>**/*.xml</include>
    </includes>
    </resource>
    <!--指定资源的位置-->
    <resource>
    <directory>src/main/resources</directory>
    <filtering>true</filtering>
    <excludes>
    <exclude>application*.yml</exclude>
    </excludes>
    </resource>
    <resource>
    <filtering>true</filtering> <-- filtering=true 表示可以替换 @profile.active@ 变量 --/>
    <directory>src/main/resources</directory>
    <!--引入所需环境的配置文件-->
    <includes>
    <include>application.yml</include>
    <include>application-${profile.active}.yml</include>
    </includes>
    </resource>
    </resources>


    <plugins>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    </plugins>
    </build>

    maven 最后maven打包命令 clean package -U -P dev -pl dih-server -am

























  • 相关阅读:
    centos7.5搭建zabbix3.4.x以及mysql定制化监控
    dockerfile 的常用讲解
    使用nginx快速搭建文件服务器
    centos7 安装ELK
    centos7 安装Gitlab
    centos7 安装jenkins
    ansible-playbook使用详解
    DNS主从配置
    ansible 安装部署文档
    WPF Grid MouseWheel事件无法触发
  • 原文地址:https://www.cnblogs.com/syscn/p/13692284.html
Copyright © 2020-2023  润新知