我如何列出所有 sbt 依赖项? [英] How I can list all sbt dependencies?

查看:51
本文介绍了我如何列出所有 sbt 依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to list all sbt dependencies in order to check if already exists a debian package (I also notice that there is a DEB package but it seems that external dependencies are not packaged).

目前我按照以下步骤列出了 sbt 依赖项:

At the moment I did a list of sbt dependencies with the following steps:

  1. 手动安装 sbt

我创建了一个简单的脚本,用于提取 ~/.ivi2 目录中的所有 jar 文件(不包括 sbt jar).执行结果如下:

I created a simple script that extract all jar files in ~/.ivi2 directory (excluding sbt jar). Here the result of the execution:

Group;Artifact;Artifact+Version
org.scala-lang;jline;jline-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;jline;jline-2.11
com.thoughtworks.paranamer;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.fusesource.jansi;jansi;jansi-1.4
org.spire-math;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 依赖项的方法是否正确?

Do you think is the right way to list all sbt dependencies?

推荐答案

有一个很好的 sbt 插件:https://github.com/jrudolph/sbt-dependency-graph

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

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.0")

调用 sbt dependencyTree 你可以得到一个ascii 图",如:

Calling sbt dependencyTree you can get an "ascii graph" like:

...
[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
...

这篇关于我如何列出所有 sbt 依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆