将资源从makeWarTask
复制到WEB-INF。它适用于 Gradle 版本2.10
。但升级到4.6
后,它停止了复制。
task makeWarTask(type: War) {
webInf{
from('build/resources/slave') {
include 'base.xml'
into('classes/')
}
from('build/classes/slave/com/test/util') {
include 'DBConstant.class'
into('classes/com/test/util/')
}
}
}
是否有任何版本语法更新或其他任何内容?
答案 0 :(得分:1)
从Gradle 4.0开始,编译的类不再是build/classes/<source-set-name>
,而是build/classes/<language>/<source-set-name>
,请参阅release notes。所以在你的情况下可能在build/classes/java/slave
。
您的任务配置应如下所示:
task makeWarTask(type: War) {
webInf{
from('build/resources/slave') {
include 'base.xml'
into('classes/')
}
from('build/classes/java/slave/com/test/util') {
include 'DBConstant.class'
into('classes/com/test/util/')
}
}
}