English | 中文
If you find the Sbt Dependency Analyzer interesting, please ⭐ Star it at the top of the GitHub page to support us.
The plugin is available since IntelliJ IDEA 2023.1 (Community, Ultimate and Android Studio)
- View Dependency Tree
- Show Conflicts
- Search Dependencies
- Show Dependencies Between Modules
- Show JAR Size
- Goto Dependency
- Clicking on them will take you to the location of the dependency in
build.sbt
- Available only for user-defined dependencies
- Clicking on them will take you to the location of the dependency in
- Dependency Exclusion (Experimental)
- Selecting transitive dependencies in user-defined dependencies indicates exclusion, while selecting user-defined dependencies indicates deletion itself
- Available since Sbt Dependency Analyzer
0.5.0-242.21829.142
This plugin will automatically generate project/sdap.sbt
when the first analysis fails and insert the addDependencyTreePlugin
(or addSbtPlugin(...)
) statement into it. If generated, please do not modify or delete project/sdap.sbt
.
This plugin relies on sbt-dependency-tree
, a third-party plugin, which is now integrated into sbt by default (although it won't be enabled by default, as explained in this sbt issue).
Let's explore how to use it!
Default shortcut: Ctrl + Shift + L
The plugin utilizes the following sbt commands. However, rest assured that the plugin has been optimized to minimize the number of executions as much as possible: organization
,moduleName
,dependencyDot
,reload
,update
If you are uncertain, you can safely skip these configurations!
By utilizing configurations, analysis wait times can be significantly reduced:
File Cache Timeout
If the dependent file (.dot
) has not been modified within the last 3600 seconds
(default value), the plugin will continue to use the existing file for analysis,
otherwise the dependencyDot
command will be executed, which is a certain degree of caching, but the caching may not take effect when the project first opens the analysis graph.
Organization
If you specify this value, the organization
command will not be used to retrieve your project's organization.
Disable Scopes
If you do not need to analyze all scopes, simply disable the scope(s) you wish to skip.
Configurations are persistent and associated with each IntelliJ project.
Like other plugins, this one maintains its own storage in .idea/bitlap.sbt.dependency.analyzer.xml
. Deleting this file will clear the cache.
Due to the plugin's requirement to use sbt shell, opening the dependency analysis view and subsequently using IntelliJ IDEA to reload or build the project may lead to the following issue:
Caused by: java.io.IOException: Could not create lock for \\.\pipe\sbt-load5964714308503584069_lock, error 5
To avoid this problem, utilize sbt shell for reloading or building the project:
Ensure that you have applied one of the following settings to help identify the correct module:
- The
organization
in Advanced Setup has been configured. - The
organization
value has been set inbuild.sbt
viaThisBuild
orinThisBuild
.
Note: Sub modules that are not in the
dependsOn
of the root project will not be parsed and their dependencies will be empty.
This project is developed using JetBrains IDEA. Thanks to JetBrains for providing me with a free license, which is a strong support for me.