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的可视化界面里面配置





  • 相关阅读:
    在光驱按钮不好使用时如何关闭光驱门
    将24位及32位图像数据保存到位图中
    VIM代码自动完成
    加载TLBB场景(一)
    创建异形窗口
    Windows快速关机与重启
    Direct3D9应用CEGUI
    利用GDI+加载图片
    ubuntu MP3乱码解决
    asp.net动态生成控件及访问控件
  • 原文地址:https://www.cnblogs.com/jeffen/p/6136341.html
Copyright © 2011-2022 走看看