Setting a third-party plugin setting in sbt AutoPlugin
我有一个AutoPlugin,它聚集了几个第三方插件,并为我们公司自定义了它们的设置。对于大多数插件,将它们放在
中可以很好地工作
我也尝试对ScalaStyle进行此操作:
1 2 3 4 5 |
此设置在使用我的插件的项目中从不可见,而是sbt使用插件提供的默认值:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | > 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
问题可能是什么?
此问题很可能是由应用设置的顺序引起的。如果您的插件和您所依赖的插件都是自动插件,则
Scalastyle仍使用旧的插件格式。它也没有遵循最佳实践。它不应设置
最简单的解决方法是将Scalastyle设置为