Wednesday, February 23, 2022

[SOLVED] Debian Package SBT with timestamp

Issue

I am new to Scala and SBT, but I came across the JDebPackaging plugin, which appears to be based on the JDeb java plugin.

I want to be able to do snapshotExpand=true, which is done in maven like this:

<snapshotExpand>true</snapshotExpand>

Can anyone help me do the same in SBT?

Update: I am using the following

plugins.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.3")

build.sbt
enablePlugins(JavaAppPackaging)
enablePlugins(JDebPackaging)

What we want, is to be able to timestamp the debian package. Does anyone know of a way to do this?


Solution

I worked around with the following function:

version := "0.1." + timestamper()

def timestamper() = {
  val today = Calendar.getInstance().getTime()
  new SimpleDateFormat("yyyyMMddHHmm").format(today)
}

if anyone has a better solution then let know



Answered By - Causteau
Answer Checked By - Marilyn (WPSolving Volunteer)