我有一个 AutoPlugin,它聚合了几个第三方插件并为我们公司定制了它们的设置。对于大多数插件,将它们放在以下位置即可正常工作projectSettings
:
override lazy val projectSettings = Seq( somePluginSetting := "whatever" )
我也尝试为 ScalaStyle 这样做:
import org.scalastyle.sbt.ScalastylePlugin.scalastyleConfigUrl
override lazy val projectSettings = Seq(
scalastyleConfigUrl := Some(url("http://git.repo/scalastyle-config.xml"))
)
此设置在使用我的插件的项目中永远不可见,而是 sbt 使用插件提供的默认值:
> inspect scalastyleConfigUrl
[info] Setting: scala.Option[java.net.URL] = None
[info] Description:
[info] Scalastyle configuration file as a URL
[info] Provided by:
[info] {file:/Users/kaeser/Documents/workspace/ci-test-project/}root/*:scalastyleConfigUrl
[info] Defined at:
[info] (org.scalastyle.sbt.ScalastylePlugin) Plugin.scala:101
[info] Delegates:
[info] *:scalastyleConfigUrl
[info] {.}/*:scalastyleConfigUrl
[info] */*:scalastyleConfigUrl
[info] Related:
[info] test:scalastyleConfigUrl
当我将设置直接放入 build.sbt 时,它按预期工作。
我做了一个简单的示例 sbt 插件来显示问题:https ://github.com/jastice/sbt-customsettings
问题可能是什么?