如何使用 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 的第一个项目,所以我不确定接下来要测试或调查什么。
I followed the instructions here, and it worked but only if it was mapped to a directory other than the default.
Here's a sample that I tried:
<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>
So my assumptions is that I have something else overriding the configuration. However, this is my first project using maven, so I'm not sure what to test or investigate next.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将排除更改为
您还可以从目录中删除 WEB-INF 并完全删除 targetDirectory。例如,这里将包含所有 xml、xhtml、x*ml 等,并排除任何目录中的所有 *.tmp
change your exclusion to
You could also leave off the WEB-INF from the directory and remove the targetDirectory altogether. For instance, here's one that would include all xml, xhtml, x*ml etc. and excludes all *.tmp in any directory