如何在gradle war中排除目录及其内容 [英] How to Exclude directory and its contents in gradle war

查看:946
本文介绍了如何在gradle war中排除目录及其内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 gradle war插件,我试图在打包时在 WEB-INF 目录中排除一些目录一场战争,但排除似乎并不奏效。
这就是我所拥有的

$ $ $ $
$ b $' / config'
}
exclude('metadata / **')
}

对此有何解决方案?

解决方案

排除名为<$ c的文件夹code> WEB-INF 中包含的$ c>元数据在您的build.gradle文件中使用以下代码:

  war.rootSpec.exclude(** / WEB-INF / metadata /)

或根据您的编码风格,您也可以使用:

  war 
{
rootSpec.exclude(** / WEB-INF / metadata /)
}

Gradle论坛上的此链接也可能有帮助


I am using gradle war plugin, I am trying to exclude some directories inside WEB-INF directory while packing a war, but the excludes don't seem to work. This is what I have

 war {
   webInf {
        from 'src/main/config'
    }
   exclude('metadata/**')
  }

Any solution on this ?

解决方案

To exclude a folder named metadata contained in WEB-INF use the following code in your build.gradle file:

war.rootSpec.exclude("**/WEB-INF/metadata/")

or depending on your coding style you could also use:

war 
{ 
    rootSpec.exclude("**/WEB-INF/metadata/") 
}

This link on the gradle discussion forum may also be of help

这篇关于如何在gradle war中排除目录及其内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆