如何使用maven war插件从目标目录中排除文件/目录?
问题描述:
我按照指示here,它的工作,但只有它被映射到一个目录以外的默认。如何使用maven war插件从目标目录中排除文件/目录?
下面是我试过的例子:
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<!-- the below works when uncommented and does exclude *.tmp -->
<!-- <targetPath>test/WEB-INF</targetPath> -->
<!-- the below does not -->
<targetPath>WEB-INF</targetPath>
<excludes>
<exclude>*.tmp</exclude>
</excludes>
</resource>
</webResources>
</configuration>
所以我的假设是,我有别的东西覆盖了配置。不过,这是我使用maven的第一个项目,所以我不确定接下来要测试或调查什么。
答
你排斥改变
**/*.tmp
你也可以从目录中留下关闭WEB-INF和完全消除targetdirectory中。例如,这里包含所有xml,xhtml,x * ml等,并排除任何目录中的所有* .tmp。
<webResources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<includes>
<include>**/*.x*ml</include>
</includes>
<excludes>
<exclude>**/*.tmp</exclude>
</excludes>
</resource>
</webResources>