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?

+3


source to share


2 answers


Adding the version property and setting its value to an empty string worked for me.

Here's an example:



project(':CodeTools_dummydriver-true') {
    ext.dummyDriver = true
    archivesBaseName = "dummydriver-true"
    version= ""
}

      

Hope it helps.

+2


source


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.

+2


source







All Articles