Is there any way to configure distribution file name when creating archive using distribution plugin in gradle?
Here is my build.gradle
(I'm using gradle 2.10
) file:
apply plugin: 'distribution'
version '1.2'
distributions {
custom {
baseName = 'someName'
contents {...}
}
}
And calling the task customDistZip
creates file: $buildDir/distributions/someName-1.2.zip
I would like to have a file name configurd to: someName.zip
(without version number).
My workaround for this is to create new task to rename the zip file after creation and use gradle finalizedBy
feature:
task renameDist {
doLast {
new File("$buildDir/distributions/someName-${project.version}.zip")
.renameTo("$buildDir/distributions/someName.zip")
}
}
customDistZip.finalizedBy renameDist
But this don't look like elegant and nice solution.
You can either do:
customDistZip.setVersion('')
to set the version string used with baseName
to empty or
customDistZip.setArchiveName('someName.zip')
to set the full archive filename, which skips basename alltogether.