- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图了解 SBT scope axes是以及它们如何影响构建映射中的作用域键。
共有三个范围轴:project
, configuration
和 task
.
最佳答案
来自 Custom settings and tasks :
Keys have one of three types:
SettingKey
,TaskKey
andInputKey
.
val scalaVersion = settingKey[String]("The version of Scala used for building.")
show
:
> show scalaVersion
[info] 2.10.4
inspect
了解键的详细信息(这不完全是键,而是您很快就会了解的设置):
> inspect scalaVersion
[info] Setting: java.lang.String = 2.10.4
[info] Description:
[info] The version of Scala used for building.
[info] Provided by:
[info] */*:scalaVersion
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:236
[info] Reverse dependencies:
[info] *:libraryDependencies
[info] *:scalaInstance
[info] *:evicted
[info] *:dependencyUpdatesData
[info] *:update
[info] *:allDependencies
[info] Delegates:
[info] *:scalaVersion
[info] {.}/*:scalaVersion
[info] */*:scalaVersion
[info] Related:
[info] */*:scalaVersion
settingKey
定义自己的 key :
lazy val abc: sbt.SettingKey[String] = settingKey[String]("My own setting key")
Identifies a setting. It consists of three parts: the scope, the name, and the type of a value associated with this key. The scope is represented by a value of type Scope. The name and the type are represented by a value of type AttributeKey[T]. Instances are constructed using the companion object.
SettingKey
有所需的
def scope: Scope
描述设置的范围。很快就会被解释。
Initialize[T]
或只是
T
到
SettingKey[T]
通过
:=
,
+=
和
++=
(更常用和推荐)或
<++=
,
<+=
和
<<=
运算符(即
sbt.SettingKey 的 scaladoc 中描述的 Scala 方法)。
abc := "my value"
abc.:=("my value")
:=
的定义中看到的那样:
final def :=(v: T): Def.Setting[T]
Setting[T]
.
SettingKey[T]
,
Initialize[T]
)或简单地(
SettingKey[T]
,
T
)是
Setting[T]
.
Setting[T]
类型的设置在哪里
T
是作为设置评估结果的值的类型,描述了对构建中所有设置的映射的转换。这是构建加载后将在键下可用的值的配方。
final def in(scope: Scope): SettingKey[T]
更改设置的范围。 .
inspect
了解设置。
> inspect abc
[info] Setting: java.lang.String = my value
[info] Description:
[info] My new setting key
[info] Provided by:
[info] {file:/Users/jacek/sandbox/sbt-theory/}sbt-theory/*:abc
[info] Defined at:
[info] /Users/jacek/sandbox/sbt-theory/build.sbt:3
[info] Delegates:
[info] *:abc
[info] {.}/*:abc
[info] */*:abc
Delegates
部分)委托(delegate)给
*:abc
,
{.}/*:abc
和
*/*:abc
.我将描述为
A/B:K
的其他地方是
A
- 项目轴,
B
- 配置轴和
K
键或任务范围(因为 sbt 允许出现在
::
之后的属性)。
*:abc
的值是多少是。
inspect
它。
> inspect *:abc
[info] Setting: java.lang.String = my value
[info] Description:
[info] My new setting key
[info] Provided by:
[info] {file:/Users/jacek/sandbox/sbt-theory/}sbt-theory/*:abc
[info] Defined at:
[info] /Users/jacek/sandbox/sbt-theory/build.sbt:3
[info] Delegates:
[info] *:abc
[info] {.}/*:abc
[info] */*:abc
{.}/*:abc
的值是多少对应于表示为
{.}
的此构建在全局配置
*
.
inspect
它。
> inspect {.}/*:abc
[info] No entry for key.
[info] Description:
[info] My new setting key
[info] Delegates:
[info] {.}/*:abc
[info] */*:abc
[info] Related:
[info] *:abc
abc
没有任何值(value)设置
ThisBuild
(又名
thisBuild
)范围。设置在
build.sbt
使用:
abc in ThisBuild := "abc in ThisBuild"
inspect
它(在
reload
之后重新加载构建的更改):
> inspect {.}/*:abc
[info] Setting: java.lang.String = abc in ThisBuild
[info] Description:
[info] My new setting key
[info] Provided by:
[info] {file:/Users/jacek/sandbox/sbt-theory/}/*:abc
[info] Defined at:
[info] /Users/jacek/sandbox/sbt-theory/build.sbt:5
[info] Delegates:
[info] {.}/*:abc
[info] */*:abc
[info] Related:
[info] *:abc
build.sbt
如下所示:
lazy val abc: sbt.SettingKey[String] = settingKey[String]("My new setting key")
abc := "my value"
abc in ThisBuild := "abc in ThisBuild"
abc
每个范围具有不同值的键 -
ThisBuild
和
Global
.清除?问远点!
关于sbt - 范围如何影响构建中的键?什么是范围轴?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25988630/
我有兴趣弄清楚 sbt.TaskKey 或 sbt.SettingKey 的一些操作是做什么的 n + "-assembly-" + v + ".jar" } 此时你必须以某种方式知道 jarN
是否可以在 SBT 中注释掉整个文本 block ,类似于 /* Java 样式 block 注释 */ 语法?我遇到了一些构建错误,只能使用多个单行注释。 我看到的构建错误是解析表达式时出错。确保设
我在 Windows 上运行 SBT 1.1.1。 如果我将以下行放在 build.sbt 中,我的构建就可以了: credentials += Credentials(Path.userHome /
Maven 有 optional dependency概念。在 SBT 文档中搜索可选依赖项仅找到 "However, sometimes we have optional dependencies
我有一个 sbt 项目,其中包含大量子项目和外部库依赖项。 build.sbt是这样的: val extlib1 = "xy.xxx" % "lib1" % "1.0+" val extlib2 =
在编译我的 SBT 项目定义(即 project 目录中的文件)时,我收到了弃用和功能警告。 SBT 版本是 0.13.0。 我没有通过设置 scalacOptions := Seq("-featur
根据经验, build.sbt 中声明的库依赖项的顺序似乎很重要。这是真的?如果是这样,值得在 sbt library management 中简要提及。文档的部分。 最佳答案 是的,列出的顺序是用于
我希望我遗漏了一些东西,因为当程序在 sbt 中运行时,按键似乎不会回显到屏幕上。 下面是一个例子: object ConsoleTest extends App { println("Enter
[SBT 文档] 说 Put settings in a .sbt file in a project that isn't checked into version control, such as
这个问题在这里已经有了答案: How to use sbt from behind proxy? (16 个回答) 7年前关闭。 我试图在防火墙后面运行 sbt,但我无法禁用它。但不知何故,我可以获得
我刚刚偶然发现了 sbt-pack插入。开发流好像steady .这让我感到惊讶,因为我认为(引用 sbt-pack 的标题)唯一的插件是“创建可分发的 Scala 包”。是 sbt-assembly
如何配置 sbt 以使用代理? 例如,我的构建定义需要连接到 GitHub,指定 http.proxy、http.proxyPort、user 的连接参数,和密码。 我如何将这些设置传递给 sbt?
我似乎无法找到下面看到的第一次驱逐的根本原因。如下所示,运行 evicted 不会提供与其相关的详细信息。 这一切都是在添加到 project/plugins.sbt 之后发生的:libraryDep
我正在用 sbt 0.11.2 创建一个 Scala 项目和 sbt-idea,我得到了 UNRESOLVED DEPENDENCIES在 gen-idea任务。 我刚刚安装了 sbt(下载了 jar
对于使用 sbt 0.13.5 成功构建的项目(尝试升级到 0.13.6,仍然无法正常工作),我们在构建服务器上突然出现故障(typesafe 和 maven 存储库通过我们的内部 Nexus 存储库
在 unix shell 中试试这个: git clone git@github.com:jsuereth/sbt-in-action-examples.git cd sbt-in-action-ex
我想知道什么时候应该使用sbt assembly,什么时候应该使用sbt compile && sbt package? 我正在使用 Intellij IDEA 在我的本地计算机上编写一个程序,并使用
有没有人使用 sbt-aether-deploy 将 sbt-native-packager 生成的工件(在我的例子中是 tgz)发布到 nexus 仓库? (我需要这个用于带时间戳的快照,特别是 n
我正在尝试在使用 SBT 版本 0.13.5 的项目中启用自定义 AutoPlugin。当我尝试在我的 build.sbt 中启用插件时通过: val aProject = project.in(fi
我正在安装Apache Spark它使用自己的 SBT 副本来进行设置。 我在 VirtualBox 虚拟机中使用 Linux Mint。 以下是我从 Spark 目录 spark-0.9.0-inc
我是一名优秀的程序员,十分优秀!