1
votes

My project uses Play Framework 2.3.7 (that uses sbt 0.13.5, sbt-native-packager and Activator 1.2.12) and I'm generating a tar.gz file with

activator universal:package-bin

The generated tar.gz file include the directories (conf, bin, share, conf).

I need a base directory (/opt/my_application/) inside the tar.gz file, resulting in:

/opt/my_application/conf
/opt/my_application/bin

I tried several mappings combinations in my build.sbt from http://www.scala-sbt.org/sbt-native-packager/formats/universal.html, with no success.

Thanks

2

2 Answers

0
votes

One alternative is add a sbt task to call a bash script:

lazy val generateTarGz = taskKey[Unit]("Generate tar.gz file")

generateTarGz := {
    "build.sh" !    
}

Then you call:

activator clean stage generateTarGz

The bash script will be called and generate a tar.gz with target/universal/stage/*.

0
votes

You should be able to remap the existing mappings in Universal as described filter-remove-mappings examples. I should look something like this

mappings in Universal := {
    val universalMappings = (mappings in Universal).value
    val appName = name.value
    universalMappings map {
        case (file, path) =>  (file, s"$appName/$path")
    }
}