warSourceExcludes和packagingExcludes的差别

maven的war plugin插件里有两个参数warSourceExcludes和packagingExcludes,从clean package后的效果来说,他们都能起到打war包时不包含指定文件夹或者指定文件的作用。

但是他们实现的方式不一样。按照plugin中对这两个参数的说明:

warSourceExcludes: The comma separated list of tokens to exclude when copying the content of the warSourceDirectory.

packagingExcludes: The comma separated list of tokens to exclude from the WAR before packaging.

With packagingExcludes, the tokens are completely excluded from the final war file. With warSourceExcludes, the tokens are just ignored when copying the war directory into the war file. As a result, if the tokens are present in the webappDirectory for example, they will not be ignored when using warSourceExcludes but will be when usingpackagingExcludes.

warSourceExcludes是在拷贝文件到war文件夹时忽略掉指定文件或者文件夹(但是如果war命令前没有clean指令,而war文件夹下已经包含了指定文件或者文件夹时,最后生成的war包里还是会包含这些文件或文件夹,哪怕没有拷贝它们到war文件夹).

packagingExcludes是在生成war包时不包含指定文件或文件夹到war文件中,不论它们是否存在于war文件夹下。

因此慎重起见,更倾向于使用packagingExcludes参数。

 

转载于:https://my.oschina.net/u/237688/blog/688762

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值