【问题标题】:How can I have an optional Sbt setting?我怎样才能有一个可选的 Sbt 设置?
【发布时间】:2014-06-02 17:21:33
【问题描述】:

有一个项目与多个参与者共享。一些参与者在~/.sbt/0.13/plugins/plugins.sbt 安装了全局 sbteclipse,而其他参与者没有。

我想在项目的build.sbt里放一些sbt设置,比如:

EclipseKeys.createSrc := EclipseCreateSrc.Unmanaged + EclipseCreateSrc.Managed + EclipseCreateSrc.Source

我希望仅将这些设置应用于那些安装了全局 sbteclipse 的参与者,并且不影响其他人。

我怎样才能做到这一点?

【问题讨论】:

    标签: scala reflection sbt sbteclipse


    【解决方案1】:

    我尝试使用一些复杂的设置,例如:

    try {
      Class.forName("com.typesafe.sbteclipse.plugin.EclipsePlugin$EclipseKeys").getMethod("createSrc").invoke(null).asInstanceOf[SettingKey[_]] := ...
    catch {
      case e: Exception => Seq.empty : SettingsDefinition
    }
    

    我仍在寻找更好的解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-06
      • 2016-04-04
      相关资源
      最近更新 更多