For example , if I ran sbt package
and sbt will generate a jar name like project_2.11-version.jar
, how can I modify this name to a random name?
Here is what the docs say:
The generated artifact name is determined by the artifactName setting. This setting is of type (ScalaVersion, ModuleID, Artifact) => String.
And the default implementation is:
artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
artifact.name + "-" + module.revision + "." + artifact.extension
}
You can copy this code into your build.sbt
or Build.scala
file and change how it constructs the artefact name. For example:
artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
java.util.UUID.randomUUID.toString + "." + artifact.extension
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With