摇篮:战争任务有冲突的包含/排除 [英] Gradle: War Task has Conflicting Includes/Excludes
问题描述
我试图建立与摇篮war文件,但我有除了其中一个目录,包括另一碰巧有同样名字的问题,但不同的父目录。
I am trying to build a war file with Gradle, but I'm having an issue excluding one directory and including another that happen to have the same names, but different parent directories.
请在下面的第一个code例子注意到没有的 CSS /
被包含在最终的战争目录
文件 - 我想是因为摇篮认为我要排除的任意目录名为 CSS /
不管其绝对路径
Please notice in the first code example below that neither of the css/
directories are being included in the final war
file -- I assume because Gradle thinks that I want to exclude any directory named css/
regardless of its absolute path.
基本上我要排除的src /主/ web应用/ CSS
,包括打造的/ tmp / CSS
,因为后者包含缩小的code。我怎样才能做到这一点?我试过,指定以各种方式绝对路径,但都没有成功。
Basically I want to exclude src/main/webapp/css
and include build/tmp/css
because the latter contains the minified code. How can I achieve this? I've tried specifying an absolute path in various ways but haven't had any success.
war {
dependsOn minify
from('build/tmp/') { include ('css/') }
exclude('WEB-INF/classes/', 'css/')
}
如果我不排斥 CSS /
像这样:
war {
dependsOn minify
from('build/tmp/') { include ('css/') }
exclude('WEB-INF/classes/')
}
,那么结果是,无论是缩小的,并且包括非精缩code
then the result is that both the minified and non-minified code is included.
推荐答案
我不知道为什么你排除 WEB-INF /班/ CSS
而不是的src /主/ web应用/ CSS
在你的build.gradle,但复制缩小的CSS文件,而不是原有的被实现的:
I am not sure why you exclude WEB-INF/classes/css
instead of src/main/webapp/css
in your build.gradle, but copying the minified CSS files instead of the original ones is achieved by:
apply plugin: 'war'
war {
// dependsOn 'minify'
from 'src/main/webapp'
exclude 'css' // or: "exclude 'WEB-INF/classes/css'"
from('build/tmp/css') {
include '**/*.css'
into 'css' // or: "into 'WEB-INF/classes/css'"
}
}
这篇关于摇篮:战争任务有冲突的包含/排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!