When sbt builds a OneJar file using the SbtOneJar plugin it gives the built jar the name [name]_[scala-version]-[version]-one-jar.jar where name is the name of the project, scala-version is the scalaVersion and version is the version of the project, all variables in the build.sbt file.

How can one set up the build.sbt file so that the name of the jar is [name]-one-jar_[scala-version]-[version].jar

有帮助吗?

解决方案

Add the following lines to the build.sbt:

// This gets rid of the trailing "-one-jar"

artifact in oneJar <<= moduleName(Artifact(_))

// rename the jar

artifact in oneJar ~= { (art: Artifact) =>
  art.copy(`type` = "jar", extension = "jar", name = art.name + "-one-jar")
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top