Maven打包pom里面配置exclude 排除掉环境相关的配置文件

有几种方式:
1. 打包时,指定环境参数把环境的配置文件复制过去
2. 不打包所有的环境相关的配置文件,直接由运维的人维护

可以在上传war包前把配置给改了,用rar工具改里面的配置,但每次都改太麻烦
第一次上面放有这个配置文件,后面打包时排除掉就可以了,上面的解压后就不会覆盖了
我们公司就用2,后面打包时排除掉就可以了,上面的解压后就不会覆盖了

Maven打包pom里面配置exclude 排除掉环境相关的配置文件, resources excludes
关于Maven resource配制中include与exclude的关系
<include>与<exclude>是用来圈定和排除某一文件目录下的文件是否是工程资源的。如果<include>与<exclude>划定的范围存在冲突时,以<exclude>划定的范围为准。大多数情况下,人们使用<include>和<exclude>是为了配合<filtering>实现过滤特定文件的需要。例如,在一个工程中,src/main/resources目录下都是工程的资源文件,并不需要<include>和<exclude>再进行划定。但如果我们需要对且仅对其中的jdbc.properties和mail.properties两个文件进行过滤的话,则需要借助<include>和<exclude>进行如下的配置:

<resources>
<!-- Filter jdbc.properties & mail.properties. NOTE: We don't filter applicationContext-infrastructure.xml,
let it go with spring's resource process mechanism. -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>jdbc.properties</include>
<include>mail.properties</include>
</includes>
</resource>
<!-- Include other files as resources files. -->
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>jdbc.properties</exclude>
<exclude>mail.properties</exclude>
</excludes>
</resource>
</resources>

其中第一段<resource>配置声明:在src/main/resources目录下,仅jdbc.properties和mail.properties两个文件是资源文件,然后,这两个文件需要被过滤。而第二段<resource>配置声明:同样在src/main/resources目录下,除jdbc.properties和mail.properties两个文件外的其他文件也是资源文件,但是它们不会被过滤。

Maven打包pom里面配置exclude 排除掉环境相关的配置文件的更多相关文章

  1. maven打包pom.xml备忘

    打包生成可执行jar 包 POM.XML <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" ...

  2. Maven学习笔记(十二)-maven打包之resource配置

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u011781521/article/details/79052725 一.简介 构建Maven项目的 ...

  3. maven关于pom文件配置详解(转载)

    转载:http://www.cnblogs.com/hafiz <project xmlns="http://maven.apache.org/POM/4.0.0" xmln ...

  4. Maven的POM.xml配置大全

    <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://mave ...

  5. Maven的pom.xml 配置详解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  6. Maven系列--pom.xml 配置详解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  7. Maven之pom.xml 配置详解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  8. SSH项目搭建(四)——Maven的pom.xml配置

    史上最全的maven的pom.xml文件详解: https://www.cnblogs.com/qq765065332/p/9238135.html 下面的节点有不理解是啥意思的可以到上面链接的文章里 ...

  9. Maven项目pom.xml配置详解

    maven项目pom.xml文件配置详解,需要时可以用作参考: <project xmlns="http://maven.apache.org/POM/4.0.0" xmln ...

随机推荐

  1. Optimizely:在线网站A/B测试平台

    Optimizely:在线网站A/B测试平台是一家提供 A/B 测试服务的公司.A/B 测试能够对比不同版本的设计,选取更吸引用户眼球的那一款,从而带来更为优化的个人体验.让网站所有者易于对不同版本的 ...

  2. [CareerCup] 18.10 Word Transform 单词转换

    18.10 Given two words of equal length that are in a dictionary, write a method to transform one word ...

  3. iptables防火墙作为基本需求的配置

    企业中使用iptables防火墙:(一般不要在命令中输入规则) # Firewall configuration written by system-config-firewall# Manual c ...

  4. Logistic Regression vs Decision Trees vs SVM: Part II

    This is the 2nd part of the series. Read the first part here: Logistic Regression Vs Decision Trees ...

  5. 百度ueditor代码高亮显示

    <script type="text/javascript" charset="utf-8" src="ueditor1_4_3-utf8-ph ...

  6. *HDU 1286,2824欧拉函数

    #include<iostream> #include<string> #include<cstdio> #include<cmath> #includ ...

  7. bootstrap学习笔记之二

    学习表单时还是有些吃力的,主要感觉有些结构有些复杂,没有自己亲手去操作就感觉似懂非懂,所以还得自己亲手测一下. 现在开始按钮的学习. 可作为按钮使用的标签和元素有:  <a>.<bu ...

  8. smarty入门

    1 2 3 4 首先要有3个文件夹configs.templates.templates_c,在configs文件夹中有一个配置文件:test.conf,代码:   title = Welcome t ...

  9. 连连看bug记录

    1.bug统计 bug1: bug现象:消除两个相同图案之间的连线跨越了其他图片. 期待现象:应该改成绕过图案呈折线形. 二者差异:折现有没有穿过其他图片. bug原因猜测:小组能力原因. 复现步骤或 ...

  10. FlipView 索引为0 WP8.1

    如果使用FlipView时,出现别的页面切换到含有FlipView的页面时(缓存此页面/MainPage),点击或者滑动FlipView,Flipview自动索引到0 的问题解决办法 1.对Flipv ...