TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sbt/sbt/llms.txt
Use this file to discover all available pages before exploring further.
DependencyTreePlugin provides tasks to visualize, analyze, and export your project’s dependency graph. This is extremely useful for understanding transitive dependencies, debugging dependency conflicts, and analyzing license information.
Activation
This plugin is automatically enabled on all projects:Key Tasks
dependencyTree
Displays project dependencies in various formats (ASCII tree, JSON, GraphML, etc.).
whatDependsOn
Shows what dependencies depend on a specific module.
dependencyLicenseInfo
Displays license information for all dependencies in text or JSON format.
Key Settings
dependencyTreeIncludeScalaLibrary
Include Scala standard library in dependency tree output. Default:
falsedependencyDotNodeColors
Enable colored nodes in DOT format output. Default:
truedependencyDotHeader
Custom header for DOT file output (e.g., to set preferred node shapes).
dependencyDotNodeLabel
Function to format node labels in DOT output. Takes organization, name, and version.
Usage Examples
Basic dependency tree
Find reverse dependencies
Export as JSON
Generate visualization with Graphviz
Scope-specific trees
Output Formats
| Format | Flag | Description |
|---|---|---|
| ASCII Tree | (default) | Human-readable tree format |
| JSON | --json | Machine-readable JSON |
| GraphML | --graphml | For yEd and other graph tools |
| DOT | --dot | For Graphviz visualization |
License Information
Check licenses of all dependencies:- Module coordinates
- License name
- License URL
- Whether license is OSI-approved
Common Use Cases
Debug dependency conflicts
Generate compliance reports
Create architecture documentation
Analyze transitive dependencies
Configuration in Compile vs Test
The plugin automatically configures tasks for bothCompile and Test configurations:
Test dependencies typically include additional libraries like test frameworks (ScalaTest, JUnit) that won’t appear in the Compile dependency tree.
Integration with Build Tools
CI/CD Pipelines
Generate dependency snapshots in CI:Dependency Analysis Tools
Export to formats compatible with:- Graphviz (DOT format) - Visual graphs
- yEd (GraphML format) - Interactive graph editor
- Custom tools (JSON format) - Automated analysis
Performance
Source Reference
Implemented across multiple files:DependencyTreePlugin.scala- Main plugin definitionDependencyTreeKeys.scala- Key definitionsDependencyTreeSettings.scala- Settings and task implementations
main/src/main/scala/sbt/plugins/
Related
- Library Dependencies - Managing dependencies
- Configurations - Understanding Compile, Test, Runtime
- IvyPlugin - Dependency resolution