sbt/README.md

76 lines
4.4 KiB
Markdown
Raw Normal View History

2015-11-26 13:18:18 +01:00
# sbt-dependency-graph
2011-11-15 16:01:32 +01:00
2015-01-30 20:55:29 +01:00
[![Join the chat at https://gitter.im/jrudolph/sbt-dependency-graph](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jrudolph/sbt-dependency-graph?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2012-05-23 12:42:04 +02:00
Visualize your project's dependencies.
2011-11-15 16:01:32 +01:00
2015-11-26 14:34:57 +01:00
## Usage Instructions
2011-11-15 16:01:32 +01:00
2017-10-24 18:18:21 +02:00
sbt-dependency-graph is an informational tool rather than one that changes your build, so you will more than likely wish to
install it as a [global plugin] so that you can use it in any SBT project without the need to explicitly add it to each one. To do
2017-10-24 18:18:21 +02:00
this, add the plugin dependency to `~/.sbt/0.13/plugins/plugins.sbt` for sbt 0.13 or `~/.sbt/1.0/plugins/plugins.sbt` for sbt 1.0:
```scala
2018-07-17 12:01:33 +02:00
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.1")
```
To add the plugin only to a single project, put this line into `project/plugins.sbt` of your project, instead.
2011-11-15 16:01:32 +01:00
The plugin currently supports sbt versions >= 0.13.10 and sbt 1.0.x. For versions supporting older versions of sbt see
2017-10-24 18:18:21 +02:00
the notes of version [0.8.2](https://github.com/jrudolph/sbt-dependency-graph/tree/v0.8.2#compatibility-notes).
2015-11-26 13:18:18 +01:00
## Main Tasks
2012-05-23 12:35:49 +02:00
* `dependencyTree`: Shows an ASCII tree representation of the project's dependencies
* `dependencyBrowseGraph`: Opens a browser window with a visualization of the dependency graph (courtesy of graphlib-dot + dagre-d3).
2016-01-08 17:29:29 +01:00
* `dependencyList`: Shows a flat list of all transitive dependencies on the sbt console (sorted by organization and name)
* `whatDependsOn <organization> <module> <revision>`: Find out what depends on an artifact. Shows a reverse dependency
2015-11-18 17:58:23 +01:00
tree for the selected module.
* `dependencyLicenseInfo`: show dependencies grouped by declared license
* `dependencyStats`: Shows a table with each module a row with (transitive) Jar sizes and number of dependencies
* `dependencyGraphMl`: Generates a `.graphml` file with the project's dependencies to `target/dependencies-<config>.graphml`.
2012-05-23 12:35:49 +02:00
Use e.g. [yEd](http://www.yworks.com/en/products_yed_about.html) to format the graph to your needs.
* `dependencyDot`: Generates a .dot file with the project's dependencies to `target/dependencies-<config>.dot`.
2012-12-18 17:41:49 +01:00
Use [graphviz](http://www.graphviz.org/) to render it to your preferred graphic format.
* `dependencyGraph`: Shows an ASCII graph of the project's dependencies on the sbt console (only supported on sbt 0.13)
2018-04-10 18:22:48 +02:00
* `ivyReport`: Lets ivy generate the resolution report for you project. Use
`show ivyReport` for the filename of the generated report
2012-05-23 12:35:49 +02:00
All tasks can be scoped to a configuration to get the report for a specific configuration. `test:dependencyGraph`,
2012-05-23 12:35:49 +02:00
for example, prints the dependencies in the `test` configuration. If you don't specify any configuration, `compile` is
assumed as usual.
2011-11-15 16:01:32 +01:00
2018-07-16 11:44:03 +02:00
Note: If you want to run tasks with parameters from outside the sbt shell, make sure to put the whole task invocation in quotes, e.g. `sbt "whatDependsOn <org> <module> <version>"`.
2015-11-26 13:18:18 +01:00
## Configuration settings
* `filterScalaLibrary`: Defines if the scala library should be excluded from the output of the dependency-* functions.
If `true`, instead of showing the dependency `"[S]"` is appended to the artifact name. Set to `false` if
you want the scala-library dependency to appear in the output. (default: true)
* `dependencyGraphMLFile`: a setting which allows configuring the output path of `dependency-graph-ml`.
* `dependencyDotFile`: a setting which allows configuring the output path of `dependency-dot`.
* `dependencyDotHeader`: a setting to customize the header of the dot file (e.g. to set your preferred node shapes).
* `dependencyDotNodeLabel`: defines the format of a node label
(default set to `[organisation]<BR/><B>[name]</B><BR/>[version]`)
E.g. in `build.sbt` you can change configuration settings like this:
```scala
filterScalaLibrary := false // include scala library in output
dependencyDotFile := file("dependencies.dot") //render dot file to `./dependencies.dot`
```
2015-11-26 13:18:18 +01:00
## Known issues
2011-11-15 17:27:53 +01:00
2015-11-26 13:35:01 +01:00
* [#19]: There's an unfixed bug with graph generation for particular layouts. Workaround:
2012-10-24 11:35:17 +02:00
Use `dependency-tree` instead of `dependency-graph`.
2011-11-15 16:01:32 +01:00
2015-11-26 13:18:18 +01:00
## License
2011-11-15 16:01:32 +01:00
Published under the [Apache License 2.0](http://en.wikipedia.org/wiki/Apache_license).
[global plugin]: http://www.scala-sbt.org/0.13/tutorial/Using-Plugins.html#Global+plugins
[global build configuration]: http://www.scala-sbt.org/0.13/docs/Global-Settings.html
[#19]: https://github.com/jrudolph/sbt-dependency-graph/issues/19