1

我已经有以下内容:

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文件中?

4

2 回答 2

2

第 1 步:创建测试 jar:

task testJar(type: Jar) {
    classifier = 'tests'
    from sourceSets.test.output
}

第 2 步:将其包含在 distZip 中:

applicationDistribution.from(testJar) {
    into "tests"
}
于 2013-07-24T13:07:28.643 回答
1
into(someFolder) {
    from packageTests
}

PS:我会这样写其他into的:

into("$jarFolderName/conf") {
    from "conf"
}
    into("$jarFolderName/bin") {
    from "bin"
}
...
于 2013-07-24T13:08:51.813 回答