简体   繁体   English

SBT:子项目中的plugins.sbt被忽略了吗?

[英]SBT: plugins.sbt in subproject is ignored?

I have a multiproject SBT build. 我有一个多项目SBT构建。 When I add plugin.sbt into subproject/project with desired addSbtPlugin declarations, sbt does not load those plugins. 当我使用所需的addSbtPlugin声明将plugin.sbt添加到subproject/project时,sbt不会加载这些插件。 Is it intended that all plugins in multi-project should be global - added to <root>/project/plugins.sbt rather than into subprojects? 是否打算将多项目中的所有插件都设置为全局 - 添加到<root>/project/plugins.sbt而不是子项目中? Ideally I'd like to have some plugin tasks under particular subproject only: subproject/somePluginTask . 理想情况下,我只希望在特定子项目下有一些插件任务: subproject/somePluginTask

I have SBT 0.13.5 我有SBT 0.13.5

Turtles all the way down 海龟一路下来

As noted in Getting Started Guide a build in sbt is a root project of a build located in project/ directory at the level. 如“ 入门指南”中所述,sbt中的内部版本是位于该级别的project/目录中的构建的根项目。 Since you have one build that's expressing the top-level multi project, the only directory that's looked into is <root>/project/ . 由于您有一个表示顶级多项目的构建,因此唯一的目录是<root>/project/

classic plugins 经典插件

Prior to sbt 0.13.5, the best practice guide suggested that plugins do not override settings and provide something like obfuscateSettings so you can opt into the plugin at the project level. 在sbt 0.13.5之前, 最佳实践指南建议插件不要覆盖settings并提供类似obfuscateSettings以便您可以在项目级别选择加入插件。 In other words, plugins are added at the build level, but the plugin settings are only loaded to each project if you wanted to. 换句话说,插件是在构建级别添加的,但插件设置仅在您希望的情况下加载到每个项目。 The plugins you're using may or may not be following this guide. 您正在使用的插件可能会也可能不会遵循本指南。

auto plugins 自动插件

The main feature that was introduced in sbt 0.13.5 is auto plugin , which should make it easier for you to not only enable plugins at each project level but also disable them if they were loaded automatically. sbt 0.13.5中引入的主要功能是自动插件 ,它不仅可以让您更轻松地在每个项目级别启用插件,还可以在自动加载时禁用它们。

lazy val app = (project in file("app"))
  .enablePlugins(HelloPlugin)

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

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