【发布时间】:2018-04-09 00:59:06
【问题描述】:
我正在尝试开发一个非常小的自动插件来覆盖所有项目和子项目的本地配置。具体来说,我希望我的插件更改 scalaVersion 并向包含它的项目的 scalacOptions 添加一个选项。 I have read in the documentation 可以更改分配设置的顺序,但似乎我没有将它们分配给正确的项目。 这是我到目前为止的代码:
// build.sbt
import AddSettings._
lazy val root = (project in file("."))
.settingSets(userSettings, defaultSbtFiles, autoPlugins, buildScalaFiles)
.settings(
sbtPlugin := true,
name := "sbt-scalafix-config",
organization := "io.prl-prg",
version := "0.0.1",
addSbtPlugin("org.some" % "some-other-plugin" % "0.5.3")
)
// PluginCode.scala
package config
import sbt._
import sbt.Keys._
object PluginCode extends AutoPlugin {
override def trigger = allRequirements
override lazy val projectSettings = Seq(
scalaVersion := "2.12.3",
scalacOptions := Seq( "-Yrangepos" )
)
println("[PluginCode Setup] Hello World!")
}
感谢任何帮助。
【问题讨论】: