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





  • 相关阅读:
    httpclient_1
    jmeter java请求
    fiddler监听手机
    lr文件的作用?
    配置源
    数据结构--堆
    A + B Problem II 高精度
    最小生成树(kruskal算法)+prim算法
    P3371 【模板】单源最短路径(弱化版)
    P3368 【模板】树状数组 2(实现区间修改&单点查询)
  • 原文地址:https://www.cnblogs.com/jeffen/p/6136341.html
Copyright © 2011-2022 走看看