找到你要的答案

Q:sbt 0.13.8 — what is the difference between buildSettings and projectSettings?

Q:SBT 0.13.8 - buildsettings和projectsettings之间的区别是什么?

I am writing a new plugin for 0.13.8 and I can't seem to figure out the difference between the buildSettings Seq and the projectSettings Seq. Can someone clarify?

Thanks, Hadil

我0.13.8编写新的插件,我似乎无法找出buildsettings SEQ和projectsettings序列之间的差异。有人能澄清吗?

Thanks, Hadil

answer1: 回答1:

From the docs:

With auto plugins, all provided settings (e.g. assemblySettings) are provided by the plugin directly via the projectSettings method.

And later on:

If the plugin needs to append settings at the build-level (that is, in ThisBuild) there’s a buildSettings method. The settings returned here are guaranteed to be added to a given build scope only once regardless of how many projects for that build activate this AutoPlugin.

The globalSettings is appended once to the global settings (in Global). These allow a plugin to automatically provide new functionality or new defaults. One main use of this feature is to globally add commands, such as for IDE plugins.

Use globalSettings to define the default value of a setting.

从文档:

自动插件,所有提供的设置(例如assemblysettings)提供的插件直接通过projectsettings方法。

后来:

如果插件需要追加设置在建设水平(即,在thisbuild)有一个buildsettings方法。设置返回这里都将被添加到一个给定的建造范围只有一次,不管有多少项目建设激活AutoPlugin。

的globalsettings追加一次全局设置(全球)。这些允许插件自动提供新的功能或新的默认。这个功能的一个主要用途是在全球范围内添加命令,如IDE插件。

使用globalsettings定义一个默认值设置。

scala  sbt