首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何列出所有sbt依赖项?

如何列出所有sbt依赖项?
EN

Stack Overflow用户
提问于 2016-01-04 00:16:21
回答 3查看 12.1K关注 0票数 15

我需要列出所有的sbt依赖项,以检查是否已经存在debian包(我也注意到有一个DEB包,但外部依赖似乎没有打包)。

目前,我通过以下步骤列出了sbt依赖项:

  1. 手动安装sbt
  2. 我创建了一个简单的脚本来提取~/. in 2目录中的所有jar文件(不包括sbt )。这里是执行的结果: Jlin-2.10.5 org.scala-lang;scala-compiler;scala-compiler-2.10.5 org.scala-lang;scala-library;scala-library-2.10.5 org.scala-lang;scala-reflect;scala-reflect-2.10.5 com.jcraft;jsch;jsch-0.1.46 org.scalamacros;quasiquotes_2.10;quasiquotes_2.10-2.0.1 jline;jlin-2.11 com.thoughtworks.paranamer;paranamer;偏执-2.6 org.json4s;json4s-ast_2.10;json4s-ast_2.10-3.2.10 org.json4s;json4s-core_2.10;json4s-core_2.10-3.2.10 org.scala-lang.modules;scala-pickling_2.10;scala-pickling_2.10-0.10.0 org.scala-tools.sbinary;sbinary_2.10;sbinary_2.10-0.4.2 org.fuesource.jansi;json4s-support_2.10;json4s-support_2.10-0.6.0 org.spire-math;jawn-parser_2.10;jawn-parser_2.10-0.6.0

您认为列出所有sbt依赖项的正确方法吗?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2016-01-04 00:20:37

有一个不错的sbt pluginhttps://github.com/jrudolph/sbt-dependency-graph

简单地添加到~/.sbt/0.13/plugins/plugins.sbt

代码语言:javascript
复制
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.0")

调用sbt dependencyTree可以得到"ascii图“,如:

代码语言:javascript
复制
...
[info]   | +-org.apache.lucene:lucene-spatial:4.10.2
[info]   | | +-com.spatial4j:spatial4j:0.4.1
[info]   | | +-org.apache.lucene:lucene-core:4.10.2
[info]   | | +-org.apache.lucene:lucene-queries:4.10.2
[info]   | |   +-org.apache.lucene:lucene-core:4.10.2
[info]   | |
[info]   | +-org.apache.lucene:lucene-suggest:4.10.2
[info]   |   +-org.apache.lucene:lucene-analyzers-common:4.10.2
[info]   |   | +-org.apache.lucene:lucene-core:4.10.2
[info]   |   |
[info]   |   +-org.apache.lucene:lucene-core:4.10.2
[info]   |   +-org.apache.lucene:lucene-misc:4.10.2
[info]   |   | +-org.apache.lucene:lucene-core:4.10.2
[info]   |   |
[info]   |   +-org.apache.lucene:lucene-queries:4.10.2
[info]   |     +-org.apache.lucene:lucene-core:4.10.2
...
票数 17
EN

Stack Overflow用户

发布于 2020-04-03 13:49:41

如果不需要sbt-dependency-graph提供的依赖层次结构,下面的内容可能是有用的:

代码语言:javascript
复制
sbt 'show dependencyClasspathFiles'
票数 7
EN

Stack Overflow用户

发布于 2020-07-10 21:49:00

只是在这里添加如何安装sbt-dependency-graph,,我认为这与问题相关。

重要信息:

答案仅仅是与sbt-dependency-graph.相关的部分完整的答案(sbt+scala+homebrew+plugin) --你可以找到这里

为了使用Snyk测试Scala项目,您需要安装Sbt依赖图插件。

为Sbt 0.13先决条件安装sbt依赖图插件

确保安装了Scala。

确保安装了sbt并运行了Sbt。

注意:下面的步骤将把Sbt依赖插件安装为全局插件。

  1. 首先通过键入以下命令导航到正确的目录:cd ~/.sbt
  2. 这将带您到Sbt目录。从那里,您需要导航到0.13目录。键入ls命令将显示目录中是否存在0.13和/或1.0
  3. 通过键入:cd 0.13导航到0.13,然后通过键入:mkdir plugins创建一个名为plugins的目录
  4. 通过键入:cd plugins导航到新目录,然后通过键入:touch plugins.sbt继续创建一个名为“plugins.sbt”的文件
  5. 通过首选编辑器编辑plugins.sbt文件
  6. 将以下行添加到文件中:
代码语言:javascript
复制
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
  1. 保存更改
  2. 对1.0目录执行以下步骤。通过在sbt目录中键入ls来检查是否存在1.0:
代码语言:javascript
复制
- If the 1.0 does NOT exist in the sbt directory, type `mkdir 1.0` in the sbt directory
代码语言:javascript
复制
- If 1.0 exists in the directory, run the following command: `cd ~/.sbt/1.0`
代码语言:javascript
复制
- Make a directory called “plugins” in that folder by typing: `mkdir plugins` Copy the existing “plugins.sbt” file from the 0.13 directory to the current 1.0 directory by typing the following: `cp ../0.13/plugins/plugins.sbt ./plugins`
代码语言:javascript
复制
- Validate that the plugin has been installed correctly by running the following command:  `sbt "-Dsbt.log.noformat=true" dependencyTree` [important](/questions/tagged/important) **This should be tested in the directory of the project** and by running the command will generate the dependency graph. You can also run it each time you want to generate the dependency graph)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34583171

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档