Get gradle ignore version number in jar name
I have a project that needs to compile about 10 different dummy jars for unit testing. I have a gradle project like
project(':CodeTools_dummydriver-true') {
ext.dummyDriver = true
archivesBaseName = "dummydriver-true"
}
But the problem in the jarfile is still called dummydriver-true-0.0.1.jar. Is there a way I can tell gradle to ignore the standard template and please name the output file what I want it to be named? Meaning, no version number?
source to share
The Java plugin defines a jar task to follow the following pattern for archiveName
:
${baseName}-${appendix}-${version}-${classifier}.${extension}
I don't think there is a way to apply the new "naming pattern", but what you can do is explicitly specify the name of the task jar archive like this. (Also, isn't it a dummyDriver
good idea to use the property directly rather than hardcoding "true" in the archive name?)
archivesBaseName = "dummydriver"
jar.archiveName = "${jar.baseName}-${dummyDriver}.${jar.extension}"
Alternatively, set the property version
to null or an empty string as suggested in the circadian answer, but if you ever want to use the property version
for anything, you don't want to destroy it.
source to share