我很确定它们是一样的。
从覆盖发布约定:
crossVersion 设置可以覆盖发布约定:
CrossVersion.disabled
(无后缀)
CrossVersion.binary
(_)
CrossVersion.full
(_)
默认值是CrossVersion.binary
或者CrossVersion.diabled
取决于 crossPaths 的值。
从更多关于使用交叉构建的库:
这些是等价的:
"a" %% "b" % "1.0"
("a" % "b" % "1.0").cross(CrossVersion.binary)
所以最终重要的是crossVersion
.
为了测试crossVersion
,我在我的创建了一个简单的任务build.sbt
:
lazy val getVersion = taskKey[Unit]("A simple task")
getVersion := {
List(dep1, dep2, dep3, dep4).foreach { d =>
val att = Seq(d.organization ,d.name ,d.revision ,d.configurations ,d.isChanging ,d.isTransitive ,d.isForce ,d.explicitArtifacts ,d.inclusions ,d.exclusions ,d.extraAttributes ,d.crossVersion ,d.branchName)
println(att)
}
}
lazy val dep1 = "org.typelevel" % "kind-projector" % "0.11.3" cross CrossVersion.full
lazy val dep2 = "org.typelevel" %% "kind-projector" % "0.11.3" cross CrossVersion.full
lazy val dep3 = "org.typelevel" % "kind-projector" % "0.11.3"
lazy val dep4 = "org.typelevel" %% "kind-projector" % "0.11.3"
的输出sbt getVersion
是:
List(org.typelevel, kind-projector, 0.11.3, None, false, true, false, Vector(), Vector(), Vector(), Map(), Full(, ), None)
List(org.typelevel, kind-projector, 0.11.3, None, false, true, false, Vector(), Vector(), Vector(), Map(), Full(, ), None)
List(org.typelevel, kind-projector, 0.11.3, None, false, true, false, Vector(), Vector(), Vector(), Map(), Disabled(), None)
List(org.typelevel, kind-projector, 0.11.3, None, false, true, false, Vector(), Vector(), Vector(), Map(), Binary(, ), None)
正如我们所看到的,所有的模块都是等价的,除了crossVersion
,dep1
和dep2
is Full(, )
。与其他两个不同的是Disabled()
和Binary(, )
。