首页 > 解决方案 > 是否有与 sbt-pack packMain 等效的 sbt-native-packager 选项?

问题描述

我有一个包含几个主要类的 scala 应用程序库。运行时sbt stage,sbt 正确地为我拥有的每个主类创建 bash 脚本,但具有预定义的名称(取自每个类名)。我想控制 bash 脚本的名称和传递给每个脚本的 JVM opts。

例如:给定两个主要类:FooBar 和 BarFoo,我分别得到 bin/foo-bar 和 bin/bar-foo。

我想以某种方式传递一张地图

mainClasses := Map(
  "newFooBar" -> "com.example.FooBar",
  "newBarFoo" -> "com.example.BarFoo"
)

mainClassesJVM := Map(
  "newFooBar" -> "-Xmx512m",
  "newBarFoo" -> "-Xmx2g"
)

I found an sbt plugin called sbt-pack that does what I'm trying to achieve but I was wondering if I could achieve the same only with the sbt-native-packager plugin.

Example using sbt-pack plugin:

// [Optional] Specify mappings from program name -> Main class (full package path). If no value is set, it will find main classes 
automatically
packMain := Map(
  "newFooBar" -> "com.example.FooBar",
  "newBarFoo" -> "com.example.BarFoo"
)

// [Optional] JVM options of scripts (program name -> Seq(JVM 
option, ...))
packJvmOpts := Map(
  "newFooBar" -> "-Xmx512m",
  "newBarFoo" -> "-Xmx2g"
)

Does anyone know if there is an option to achieve the above using only sbt-native-packager?

标签: sbt-native-packager

解决方案


推荐阅读