本文介绍了与sbt中的{{}/*:name`和`*/*:name`有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从某些sbt文档(例如范围),我看到:

From some sbt document(e.g. scopes), I see:

{.}/*:name

表示entire build中的name(使用name in ThisBuild进行定义)

means name in entire build(use name in ThisBuild to define it)

*/*:name

表示global project中的name(使用name in Global进行定义)

means name in global project(use name in Global to define it)

(PS:我忽略了配置部分*:)

(PS: I ignored the config part *:)

但是,我仍然不知道它们之间有什么区别,它们在我看来完全一样.

But, I still don't know what is the difference between them, they seem exactly the same to me.

我有什么可以做的而不是另一件事?

Is there any thing I can do with one rather than another one?

推荐答案

您在ThisBuild中指定的任何版本都将应用于您构建中的所有项目,从而覆盖可能在Global中定义的任何内容.

Whatever version you specified in ThisBuild will be applied to all projects in your build, overriding anything that was possibly defined in Global.

例如:键版本"

For example: Key "version"

对于全局范围,它是在Defaults.scala中定义的,其值为"0.1-SNAPSHOT".

For Global scope it was defined in Defaults.scala with value "0.1-SNAPSHOT".

对于此版本中的项目,您可能需要使用以下内容覆盖:

For your projects in this build you might want to overwrite that with:

version in ThisBuild := "3.0.1"

因此,由于[{.}/*:version]的优先级高于[*/*:version],因此,只要在项目中获得版本",便会获取"3.0.1"而不是"0.1-SNAPSHOT"

So, because [{.}/*:version] has precedence over [*/*:version], whenever you get "version" in your projects, you fetch "3.0.1" instead of "0.1-SNAPSHOT".

这在很大程度上解释了区别以及如何使用一个而不是另一个.

This pretty much explains the difference and how you could use one and not the other.

这篇关于与sbt中的{{}/*:name`和`*/*:name`有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 15:13