SBT:描述相对于另一个(传递)依赖的外部依赖?

问题描述 投票:1回答:1

为了避免震撼,我想相对地引用一个依赖项。

例如,当我向"org.http4s" %% "https-circe" % "0.21.1"添加依赖项时:

cs resolve org.http4s:http4s-circe_2.12:0.21.1 | grep -i circe                                                                                ⎈ eks-cluster-eu-west-1-dev/master
io.circe:circe-core_2.12:0.13.0:default

我想在该版本的"circe-literal"中添加一个依赖项,该依赖项由SBT的中介程序自动解决。在此示例中,"0.13.0"。这可能吗?

sbt dependency-management ivy coursier
1个回答
0
投票

一方面,您可以添加带有通配符版本的circe-literal,并且使用latest-compatible冲突管理器将获得与circe-core兼容的版本。可悲的是,如果没有求助者插件的帮助,就无法为特定工件指定冲突管理器。

但是,如果可以,您可以指定此名称:

conflictManager := ConflictManager.latestCompatible
libraryDependencies += "io.circe" %% "circe-literal % "[0,)"

不过,您必须使用常春藤解析器才能正常工作。

dependencyResolution := sbt.librarymanagement.ivy.IvyDependencyResolution(ivyConfiguration.value)

使用这个,我确切地得到了您想要的:

[info]  [SUCCESSFUL ] io.circe#circe-literal_2.12;0.13.0!circe-literal_2.12.jar (304ms)
© www.soinside.com 2019 - 2024. All rights reserved.