简体   繁体   English

如何编写Build.scala以更改在build.sbt中私下分配的SettingKey

[英]How to write a Build.scala to change a SettingKey priviously assigned in build.sbt

I have a build.sbt : 我有一个build.sbt

name := "name"

And a project/Build.scala : 还有一个project/Build.scala

import sbt._
object MyBuild extends Build {
  val root = Project(id = "root", base = file("."))
  override def settings = super.settings :+ (
    Keys.name in root ~= { oldName => oldName + "-in-scala" }
  )
}

I want a transformer in project/Build.scala , which can changes name to name-in-scala . 我想要project/Build.scala的转换project/Build.scala ,该转换器可以将name更改为name-in-scala But it does not work. 但这行不通。

How can I write a transformer in Build.scala ? 如何在Build.scala编写一个转换Build.scala

I don't think that's possible. 我认为那是不可能的。 The page http://www.scala-sbt.org/release/docs/Getting-Started/Full-Def.html#relating-build-sbt-to-build-scala states about SBT 0.12.1: http://www.scala-sbt.org/release/docs/Getting-Started/Full-Def.html#relating-build-sbt-to-build-scala页面陈述了有关SBT 0.12.1的信息:

The setting in build.sbt should "win" over the one in Build.scala. build.sbt中的设置应“赢得” Build.scala中的设置。

and

The settings in .sbt files are appended to the settings in .scala files. .sbt文件中的设置将附加到.scala文件中的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM