Using Gradle 7.4.2, when I create a ZIP archive of my main Java code, the resulting archive contains a file called previous-compilation-data.bin
. This appears to be an artifact of Gradle’s incremental build process, because if I disable incremental compilation, the file is no longer generated. previous-compilation-data.bin
is located in the build/tmp/compileJava
folder after building the project and I’m somewhat surprised this file is included in the generated ZIP archive using the following build script:
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
task buildZip(type: Zip) {
from compileJava
from processResources
into('lib') {
from configurations.runtimeClasspath
}
reproducibleFileOrder = true
preserveFileTimestamps = false
}
If I modify my ZIP task I can exclude the file, but this doesn’t feel like a robust solution to me:
task buildZip(type: Zip) {
from compileJava
from processResources
into('lib') {
from configurations.runtimeClasspath
}
exclude 'previous-compilation-data.bin'
reproducibleFileOrder = true
preserveFileTimestamps = false
}
Is it expected behaviour that the main sourceSet includes the files in build/tmp/
and if so, is there a better way to exclude previous-compilation-data.bin
from my ZIP archive?