You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To add the plugin only to a single project, put this line into `project/plugins.sbt` of your project, instead.
@@ -21,7 +21,7 @@ the notes of version [0.8.2](https://github.com/jrudolph/sbt-dependency-graph/tr
21
21
22
22
## Main Tasks
23
23
24
-
*`dependencyTree`: Shows an ASCII tree representation of the project's dependencies
24
+
*`dependencyTree`: Shows an ASCII tree representation of the project's dependencies (see [below](#dependencyTree-filtering) for examples filtering the output)
25
25
*`dependencyBrowseGraph`: Opens a browser window with a visualization of the dependency graph (courtesy of graphlib-dot + dagre-d3).
26
26
*`dependencyList`: Shows a flat list of all transitive dependencies on the sbt console (sorted by organization and name)
27
27
*`whatDependsOn <organization> <module> <revision>`: Find out what depends on an artifact. Shows a reverse dependency
@@ -40,6 +40,58 @@ All tasks can be scoped to a configuration to get the report for a specific conf
40
40
for example, prints the dependencies in the `test` configuration. If you don't specify any configuration, `compile` is
41
41
assumed as usual.
42
42
43
+
### `dependencyTree` filtering
44
+
The `dependencyTree` task supports filtering with inclusion/exclusion rules:
45
+
46
+
- exclusion rules are prefixed by `-`
47
+
- inclusion rules are the default (or can be prefixed by `+`)
48
+
49
+
Dependencies are "preserved" iff:
50
+
- they match at least one inclusion rule (or no inclusion rules are provided), and
51
+
- they match no exclusion rules (including when none are provided)
52
+
53
+
They are then displayed if they are preserved *or at least one of their transitive dependencies is preserved*.
54
+
55
+
This mimics the behavior of [Maven dependency:tree](https://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html)'s `includes` and `excludes` parameters.
56
+
57
+
#### Examples
58
+
59
+
Inclusions/Exclusions can be partial-matched against any part of a dependency's Maven coordinate:
60
+
61
+
```
62
+
dependencyTree -foo // exclude deps that contain "foo" in the group, name, or version
63
+
dependencyTree foo // include deps that contain "foo" in the group, name, or version
64
+
```
65
+
66
+
Or they can be fully-matched against specific parts of the coordinate:
67
+
68
+
```
69
+
dependencyTree -:foo* // exclude deps whose name starts with "foo"
70
+
dependencyTree -*foo*::*bar // exclude deps whose group contains "foo" and version ends with "bar"
71
+
```
72
+
73
+
Inclusions and exclusions can be combined and repeated:
74
+
```
75
+
dependencyTree foo bar -baz // include only deps that contain "foo" or "bar" and not "baz"
76
+
```
77
+
78
+
In all cases, the full paths to dependencies that match the query are displayed (which can mean that dependencies are displayed even though they would have been excluded in their own right, because they form part of a chain to a dependency that was not excluded).
79
+
80
+
#### Writing output to file
81
+
82
+
`dependencyTree` can have its output written to a file:
83
+
84
+
```
85
+
$ sbt
86
+
> dependencyTree -o foo
87
+
```
88
+
89
+
or, directly from the shell:
90
+
91
+
```bash
92
+
sbt 'dependency-tree -o foo'
93
+
```
94
+
43
95
## Configuration settings
44
96
45
97
*`filterScalaLibrary`: Defines if the scala library should be excluded from the output of the dependency-* functions.
0 commit comments