在SBT中,有没有一种方法可以下载顶级依赖项?

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

我有一个SBT项目,该项目引入依赖关系。我只想获取直接依赖关系-而不是任何传递依赖关系。我想找到引入的依赖项的文件名,以便可以将其复制到某处。

例如给定具有以下内容的build.sbt文件:

libraryDependencies += "org.eclipse.jetty" % "jetty-server" % "9.4.28.v20200408"

我想知道文件系统上的码头服务器jar在哪里。

我已经尝试将以下内容添加到我的build.sbt文件中:

lazy val mytaskKey: TaskKey[Unit] = TaskKey[Unit]("mytask")

def mytask: Def.Setting[Task[Unit]] = mytaskKey := {
  val updateReport = update.value
  updateReport.allFiles foreach { f =>
    println(f)
  }
}

mytask

运行此命令时,我会得到完整的依赖关系列表:

/Users/dylan/.sbt/boot/scala-2.12.10/lib/scala-library.jar
/Users/dylan/.coursier/cache/v1/https/repo1.maven.org/maven2/org/eclipse/jetty/jetty-server/9.4.28.v20200408/jetty-server-9.4.28.v20200408.jar
/Users/dylan/.sbt/boot/scala-2.12.10/lib/scala-compiler.jar
/Users/dylan/.sbt/boot/scala-2.12.10/lib/scala-reflect.jar
/Users/dylan/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-xml_2.12/1.0.6/scala-xml_2.12-1.0.6.jar
/Users/dylan/.coursier/cache/v1/https/repo1.maven.org/maven2/jline/jline/2.14.6/jline-2.14.6.jar
/Users/dylan/.coursier/cache/v1/https/repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.12/jansi-1.12.jar

我不想要完整的清单-我只想要码头罐子。即

/Users/dylan/.coursier/cache/v1/https/repo1.maven.org/maven2/org/eclipse/jetty/jetty-server/9.4.28.v20200408/jetty-server-9.4.28.v20200408.jar

我如何获得此列表?

sbt
1个回答
0
投票

是,有intransitive()notTransitive()分类器。已记录在here中。

© www.soinside.com 2019 - 2024. All rights reserved.