我已经拥有以下内容:
task packageTests(type: Jar) {
from sourceSets.test.output
}
distZip {
into(jarFolderName) {
from '.'
include 'conf/**'
}
into(jarFolderName) {
from '.'
include 'bin/**'
fileMode = 0755
}
into(jarFolderName) {
from 'build'
include 'logs'
}
}
添加dependOn将创建测试jar,但是如何将其包含在分发zip文件中?
答案 0 :(得分:1)
第1步:创建测试jar:
task testJar(type: Jar) {
classifier = 'tests'
from sourceSets.test.output
}
第2步:将其包含在distZip中:
applicationDistribution.from(testJar) {
into "tests"
}
答案 1 :(得分:1)
into(someFolder) {
from packageTests
}
PS:我会像这样编写其他into
:
into("$jarFolderName/conf") {
from "conf"
}
into("$jarFolderName/bin") {
from "bin"
}
...