gradle-one-jar
gradle-one-jar copied to clipboard
gradle outputs.files includes ghost file
Small thing. Not sure what the gradle-recommended behavior is here.
task oneJar(type: OneJar) {
doLast {
outputs.files.forEach{
printf('exists: %s, path: %s%n', it.exists(), it.absolutePath)
}
}
}
includes an ephemeral file
exists: false, path: /home/user/myproj/build/libs/standalone.jar
exists: true, path: /home/user/myproj/build/libs/myproj-0.0.1-SNAPSHOT-standalone.jar
which can muck up dependent gradle build scripts a little, since I would like to assume that there is only one OneJar output. So right now I have to filter out the temporary file to get the singleFile
that I am expecting.
outputs.files.filter{ it.exists() }.singleFile
Might be nothing. The last line isn't a huge deal, but might be problematic down the road for other build scripts if they reference oneJar.outputs which includes a reference to a non-existent file.
That is annoying. I wouldn't expect that ghost file to be in the outputs.files
.