I use the sbt-native-packager
to build a gzipped tar file which has the extension .tgz
. I then add that artifact using
artifact in (Compile, (packageZipTarball in Universal)) := {
val previous: Artifact = (artifact in (Compile, (packageZipTarball in Universal))).value
previous.withClassifier(Some("assembly")).withExtension("tar.gz")
},
addArtifact(artifact in (Compile, (packageZipTarball in Universal)), (packageZipTarball in Universal))
With this config the .tgz
file gets published as .tar.gz
to Nexus or the local repo.
How can I rename the .tgz
in the target directory to .tar.gz
without affecting the artifact publishing
To make sure I got your question right:
$ sbt universal:packageZipTarball
produces a file with the extension .tgz
. What you want is a file with the extension .tar.gz
.
You can achieve this by overrding the universal:packageZipTarball
and simply move the result. I haven't tested this code, but it should give you a rough idea
packageZipTarball in Universal := {
val targzFile = universal:packageZipTarball
val renamedFile = targzFile.getParent / targzFile.getName.replaceAll("\\.tgz$", ".tar.gz")
IO.move(targzFile, renamedFile)
renamedFile
}
Cheers, Muki