I am very new to SBT and need to create a RPM package for one of my project. The RPM contains only 1 file, which is a one-jar created by the sbt-onejar plugin). I want to use sbt-native-packager plugin and have created a Packagin.scala file under the /project directory like this:
object Packaging {
val settings: Seq[Setting[_]] = packagerSettings ++ deploymentSettings ++ mapGenericFilesToLinux ++ Seq(
maintainer := "Team",
packageSummary := "Summary",
packageDescription := """Description""",
mappings in Universal += {
file("target/scala-2.10/projectname_2.10-0.1-one-jar.jar") -> "/opt/projectname/projectname-0.1.jar"
},
linuxPackageMappings in Rpm <+= (baseDirectory) map { _:File =>
(packageMapping(file("target/scala-2.10/projectname_2.10-0.1-one-jar.jar") -> "/opt/projectname/projectname-0.1.jar")
withUser "someusr" withGroup "somegroup" withPerms "0755")
},
name in Rpm := "projectname",
version in Rpm <<= version apply { sv => sv split "[^\\d]" filterNot (_.isEmpty) mkString "." },
rpmRelease := "1",
rpmVendor := "Vendor",
rpmUrl := Some("url"),
rpmGroup := Some("group"),
rpmLicense := Some("BSD")
)
}
1) I don't want to hardcode the file names. Instead of having "target/scala-2.10/projectname_2.10-0.1-one-jar.jar"
I need a way to use existing SettingKey's, i.e. target + "scala-" + scalaVersion + "/" + name + "_" + scalaVersion + "-" + version + "-one-jar.jar"
- how do you do this=
2) For the value rpmRelease := "1"
I want to use a System property, i.e. in Maven I would do ${rpm.buildNumber}
, how does that work in SBT?
3) Is there anything I should do better in regards to the sbt-native-packager plugin?