通过profile 用maven命令打不同配置的变量包
生活随笔
收集整理的這篇文章主要介紹了
通过profile 用maven命令打不同配置的变量包
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
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>
來自為知筆記(Wiz)
為什么能夠根據(jù)id來加載不同的文件呢 其實是這樣的
在build節(jié)點的我們定義了如下的內(nèi)容
? ? ? ?<resources>????????????<resource>????????????????<directory>src/main/resources.${deploy.type}</directory>????????????</resource>????????????<resource>????????????????<directory>src/main/resources</directory>????????????</resource>????????</resources>其中就是這樣的定義的一個占位符 ${deploy.type} 占位符的定義如上描述的一樣?
打包的時候就是這樣的
clean install -Pdev
注意沒有空格
或者是在maven的可視化界面里面配置
來自為知筆記(Wiz)
轉(zhuǎn)載于:https://www.cnblogs.com/jeffen/p/6136341.html
總結(jié)
以上是生活随笔為你收集整理的通过profile 用maven命令打不同配置的变量包的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SPRING CLOUD服务网关之ZUU
- 下一篇: 自动化软件部署的shell脚本