zoukankan      html  css  js  c++  java
  • 通过profile 用maven命令打不同配置的变量包

    profiles定义如下
    <profiles>
            <profile>
                <id>local</id>
                <properties>
                    <deploy.type>local</deploy.type>
                </properties>
            </profile>
     
            <profile>
                <id>dev</id>
                <properties>
                    <deploy.type>dev</deploy.type>
                </properties>
            </profile>
     
            <profile>
                <id>beta</id>
                <properties>
                    <deploy.type>beta</deploy.type>
                </properties>
            </profile>
     
            <profile>
                <id>prod</id>
                <properties>
                    <deploy.type>prod</deploy.type>
                </properties>
            </profile>
        </profiles>

    为什么能够根据id来加载不同的文件呢 其实是这样的

    在build节点的我们定义了如下的内容

           <resources>
                <resource>
                    <directory>src/main/resources.${deploy.type}</directory>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                </resource>
            </resources>

    其中就是这样的定义的一个占位符 ${deploy.type} 占位符的定义如上描述的一样 

    打包的时候就是这样的

    clean install -Pdev

    注意没有空格

    或者是在maven的可视化界面里面配置





  • 相关阅读:
    WebAPI 资料
    TransactionScope事务类的使用
    Go入门笔记34-Go 使用Ioctl
    解决XShell XFTP传输Go可执行文件导致出错问题
    Go入门笔记33-Go 交叉编译
    博客园添加横向菜单
    C# 正则替换、Json格式化等
    Ubuntu批量修改文件后缀
    Linux免密登录
    Go入门笔记32-继承
  • 原文地址:https://www.cnblogs.com/jeffen/p/6136341.html
Copyright © 2011-2022 走看看