sbt-native-packager - 如何在同一个项目中使用AshScriptPlugin和LauncherJarPlugin

时间:2016-09-15 18:07:40

标签: sbt-native-packager

我的用例是让一个Play Framework应用程序在alpine docker容器中运行。

我更喜欢使用发射器罐。

所以我的build.sbt看起来像这样:

lazy val root = (project in file(".")).enablePlugins(
  PlayScala,
  JavaAppPackaging,
  LauncherJarPlugin,
  AshScriptPlugin,
  UniversalDeployPlugin
)

maintainer in Universal := "G. Richard Bellamy <rbellamy@terradatum.com>"

packageSummary in Universal := "some-server"

packageDescription := "The some-server microservice"

// Necessary because the PlayScala plugin uses sbt-native-packager, and defines the bashScriptExtraDefines in the
// expectation that the app will be using the JavaServerAppPackaging plugin with bash, and we need to use the
// JavaAppPackaging plugin with Ash
bashScriptExtraDefines := Nil

产生以下相关的起始脚本节:

real_script_path="$(realpath "$0")"
app_home="$(realpath "$(dirname "$real_script_path")")"
lib_dir="$(realpath "${app_home}/../lib")"

app_mainclass="-jar" "$lib_dir/some-server.some-server-1.0.0-SNAPSHOT-launcher.jar"

script_conf_file="${app_home}/../conf/application.ini"
app_classpath=""


# If a configuration file exist, read the contents to $opts
[ -f "$script_conf_file" ] && opts=$(loadConfigFile "$script_conf_file")

java -classpath $app_classpath $opts $app_mainclass $@

注意app_classpath=""变量。鉴于我使用了一个启动器jar,我希望省略该行。

这是一个错误,还是我做了一些明显错误的事情?

0 个答案:

没有答案