【问题标题】:Overriding archetype templates in sbt-native-packager?在SBT-Native-Packager中覆盖原型模板?
【发布时间】:2014-06-20 16:05:43
【问题描述】:

start-rpm-template 不适用于 SLES 11 SP3。

原因:Init.d/functions 不可用

# Source function library.

. /etc/rc.d/init.d/functions

在 SLES 上,功能在这里:

/lib/lsb/init-functions

项目如何提供自己的 Archetype 模板?

【问题讨论】:

    标签: scala sbt sbt-native-packager


    【解决方案1】:

    来自src/main/scala/com/typesafe/sbt/packager/linux/Keys

    val linuxMakeStartScript = TaskKey[Option[File]]("makeStartScript", "Creates or discovers the start script used by this project")
    val linuxStartScriptTemplate = TaskKey[URL]("linuxStartScriptTemplate", "The location of the template start script file we use for debian (upstart or init.d")
    val linuxEtcDefaultTemplate = TaskKey[URL]("linuxEtcDefaultTemplate", "The location of the /etc/default/<pkg> template script.")
    val linuxJavaAppStartScriptBuilder = SettingKey[JavaAppStartScriptBuilder]("linuxJavaAppStartScriptBuilder", "Responsible for loading the start scripts. Only used with archetype.java_server")
    val linuxScriptReplacements = SettingKey[Seq[(String, String)]]("linuxScriptReplacements",
      """|Replacements of template parameters used in linux scripts.
           |  Default supported templates:
           |  execScript - name of the script in /usr/bin
           |  author - author of this project
           |  descr - short description
           |  chdir - execution path of the script
           |  retries - on fail, how often should a restart be tried
           |  retryTimeout - pause between retries
           |  appName - name of application
           |  appClasspath - application classpath
           |  appMainClass - main class to start
           |  daemonUser - daemon user
        """.stripMargin)
    

    我会使用linuxMakeStartScriptlinuxStartScriptTemplatelinuxScriptReplacements

    【讨论】:

    • 感谢您的提示。我使用了linuxStartScriptTemplate build.sbt 中的一个解决方案来覆盖打包器 jar 中的模板:linuxStartScriptTemplate in Rpm := (baseDirectory.value / "src" / "rpm" / "start-rpm-template").asURL
    • 您能否更新我的答案并接受作为解决方案?我会很感激的。
    猜你喜欢
    • 2017-02-14
    • 2015-01-30
    • 2016-07-27
    • 2015-10-03
    • 2015-06-30
    • 2018-10-30
    • 2015-10-11
    • 2016-12-14
    • 2013-12-24
    相关资源
    最近更新 更多