Archive name when assembling and when uploading

I ran into a curious naming problem when performing the uploadArchive task.

When the assemble task creates a tar (zip, war) artefact, I’m assigning the desired artifact name; i.e. the script says “archiveName = ‘servermethods.tgz’”. This works as expected. But then I used the uploadArchives task to deploy the built artifacts into a flat repository. This resultet in a renaming of the produced artifact; the artifact was named after the project name and got the version into it’s name. I came about reading the chapter ‘Archive naming’ of Gradle User Guide. So I declared the baseName in the tar (war / zip) tasks and said: “achiveName=baseName”. This did somewhat the job, but resultet into something like: ‘jadice.war-3.1.0.war’ instead of what I wanted: ‘jadice.war’ (which is just the war name).

What do I have to do to get an uploadedArchive with no version info, no doubling of file extensions?

Another try resulted in two copied artifacts in the flat repository.

In the war task I declared

archiveName = 'jadice4.war'
 baseName = 'jadice4'

and in artifacts I have

archives(war) {
  name 'jadice4.war'
     }

Then I get two war files uploaded: - jadice4.war-3.1.0.war - jadice4-3.1.0.war

I just want to have one named ‘jadice4.war’.

Remove the second snippet (which is adding another war artifact) and change the first one to ‘war { archiveName = ‘jadice4.war’ }’. If that doesn’t work, try ‘war { baseName = ‘jadice4’; version = null }’.

yes, I removed then name in archives (which was just a try, and I didn’t know it would create another war). But then I’m back to my former solution. The archive built in build/lib is named jadice4.war. Fine. But in the flat repository (which is just a simple directory somewhere in non-build environment), the uploadArchives task forces a version part in the archive name - which I (my devops) do not want.

Not sure about uploading to flatdir repos. If nothing else, you can copy and rename the files rather than uploading them, or rename them after uploading. Also make sure to try ‘version = null’ as I showed above.

okay, tried with version = null. this has no effect on the file uploaded. Think I have to write some rename snippet.

Thanks