zoukankan      html  css  js  c++  java
  • maven 在spring mvc项目中开发环境 、测试环境、生产环境打包

    1.pom文件增加如下配置:

    <profiles>

    <profile>

    <!-- 本地开发环境 -->

    <id>dev</id>

    <properties>

    <profiles.active>dev</profiles.active>

    </properties>

    <activation>

    <activeByDefault>true</activeByDefault>

    </activation>

    </profile>

    <profile>

    <!-- 测试环境 -->

    <id>test</id>

    <properties>

    <profiles.active>test</profiles.active>

    </properties>

    </profile>

    <profile>

    <!-- 生产环境 -->

    <id>pro</id>

    <properties>

    <profiles.active>pro</profiles.active>

    </properties>

    </profile>

    </profiles>

    2.然后在pom文件的build里面增加

    <resources>

    <resource>

    <directory>src/main/resources</directory>

    <!-- 资源根目录排除各环境的配置,防止在生成目录中多余其它目录 -->

    <excludes>

    <exclude>test/*</exclude>

    <exclude>pro/*</exclude>

    <exclude>dev/*</exclude>

    </excludes>

    </resource>

    <resource>

    <directory>src/main/resources/${profiles.active}</directory>

    </resource>

    </resources>

    3.在resources里面,分别增加pro,dev,test三个文件夹,然后不同环境需要修改的配置文件放进去里面,如下图所示:

    4.运行mvn命令发布,相关命令如下:

    clean package -Ptest -D maven.test.skip=true 发布测试版本并且跳过测试

    clean package -Pdev -D maven.test.skip=true 发布开发版本并且跳过测试

    clean package -Ppro -D maven.test.skip=true 发布生成版本并且跳过测试

    6.出现如下图提示,表示发布成功

  • 相关阅读:
    python 默认编码( UnicodeDecodeError: 'ascii' codec can't decode)
    python发送各类邮件的主要方法
    python输出htmltestrunner中文乱码如何解决
    Python unittest 官方文档
    Python pip 安装包
    Python easy_insatll 安装包
    linux 解压操作命令
    vim 操作指令2
    vim 操作指令1
    (转)水波纹过渡特效
  • 原文地址:https://www.cnblogs.com/shuideqing/p/11924092.html
Copyright © 2011-2022 走看看