Scala sbt,没有groupID和修订版的库依赖关系?
根据sbt,libraryDependencies格式为:Scala sbt,没有groupID和修订版的库依赖关系?,scala,playframework,sbt,Scala,Playframework,Sbt,根据sbt,libraryDependencies格式为: libraryDependencies += groupID % artifactID % revision 例如: libraryDependencies += "org.postgresql" % "postgresql" % "42.1.4" 但是,在项目中,build.sbt中的guice libraryDependencies仅显示 libraryDependencies += guice 我们如何知道sbt将采用哪个g
libraryDependencies += groupID % artifactID % revision
例如:
libraryDependencies += "org.postgresql" % "postgresql" % "42.1.4"
但是,在项目中,build.sbt中的guice libraryDependencies仅显示
libraryDependencies += guice
我们如何知道sbt将采用哪个guice版本,或者该格式用于某些特定目的?当您使用Play Framework时,通常使用。您的项目/plugins.sbt中应该有它: 该插件为不同的可选依赖项定义值,例如问题中的guice。因此,您可以转到sbt插件源代码并检查此guice到底是什么: 组件定义为
def component(id: String) = "com.typesafe.play" %% id % play.core.PlayVersion.current
因此,它实际上是指play框架的play guice子项目和它在guiceDeps上的版本,这些版本定义在:
这只是为了说明它是从哪里来的。通常,当您想要检查您的可传递依赖项时,您应该使用插件。它可以在sbt shell中列出所有依赖项及其版本和其他有用信息,或者将其可视化为树或图形
val guice = component("play-guice")
def component(id: String) = "com.typesafe.play" %% id % play.core.PlayVersion.current
val guiceVersion = "4.2.0"
val guiceDeps = Seq(
"com.google.inject" % "guice" % guiceVersion,
"com.google.inject.extensions" % "guice-assistedinject" % guiceVersion
)