Skip to content

bitlap/intellij-sbt-dependency-analyzer

Repository files navigation

Sbt Dependency Analyzer for IntelliJ IDEA

logo

Project stage Build Version JetBrains Plugin Downloads

English | 中文

If you find the Sbt Dependency Analyzer interesting, please ⭐ Star it at the top of the GitHub page to support us.

Features

Support available since IntelliJ IDEA 2023.1 (231.9392.1)

  • View Dependency Tree
  • Show Conflicts
  • Search Dependencies
  • Locate Dependency (multi-module)
  • Show Dependencies Between Modules
  • Show JAR Size

Usage Instructions

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!

Simply click on the icon and wait for the analysis to complete:

Default shortcut: Ctrl + Shift + L

settings

Once the analysis is finished:

settings

More Details

The plugin utilizes the following sbt tasks. However, rest assured that the plugin has been optimized to minimize redundant executions:

  1. organization
  2. moduleName
  3. dependencyDot
  4. reload
  5. update

Advanced Setup

If you are uncertain, you can safely skip these configurations!

By utilizing configurations, analysis wait times can be significantly reduced:

settings

File Cache Timeout

If a file remains unchanged for more than 3600 seconds, the plugin will execute the dependencyDot task. Otherwise, it will use the existing one, unless you opt for a Refresh.

Organization

If you specify this value, the organization task 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.

Troubleshooting Issues

"Caused by: java.io.IOException: Could not create lock for ..."

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:

settings

Unable to analyze dependencies between modules?

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 in build.sbt via ThisBuild or inThisBuild.

JetBrains Support

This project is developed using JetBrains IDEA. Thanks to JetBrains for providing me with a free license, which is a strong support for me.

IntelliJ IDEA logo.