# Gradle dependencies

> **TL;DR**
> Required plugins for working with diagrams: Diagrams. The plugin is bundled and enabled by default.
>
>
>
> Required Gradle versions: 4.5 and later
>
>
>
> Required plugins for adding Gradle dependencies: Kotlin. The plugin is bundled and enabled by default.

IntelliJ IDEA lets you add and manage dependencies in your Gradle project. You can add dependencies and view them in the diagram.

## Generate Gradle dependencies

Any dependency added to the project is managed by Gradle. The best way to add or manage a dependency is in the build.gradle.kts file. Dependencies that you set up manually inside IntelliJ IDEA [module
settings](creating-and-managing-modules.html) will be discarded on the next Gradle project [reload](work-with-gradle-projects.html#gradle_refresh_project).

Procedure: Add a Gradle dependency

1. Open the `build.gradle.kts` file in the editor.

2. Start typing a dependency scope or a name of the dependency you want to add.

The IDE will automatically list the most relevant code completion results. If you want to manually invoke the list of suggestions, press `Ctrl+Space` (Windows), `⌃ Space` (macOS), `⌃ Space` (IntelliJ IDEA Classic (macOS)), `⌃ Space` (macOS System Shortcuts), `Ctrl+Space` (XWin), `Ctrl+Space` (GNOME), `Ctrl+Space` (KDE), `Alt+/` (Emacs), `Ctrl+Space` (Sublime Text), `⌃ Space` (Sublime Text (macOS)), `Ctrl+Space` (NetBeans), `Ctrl+Space` (Visual Studio), `⌃ Space` (Visual Studio (macOS)), `Ctrl+Space` (Eclipse), `⌃ Space` (Eclipse (macOS)). To expand the suggestion list, press `Ctrl+Space` (Windows), `⌃ Space` (macOS), `⌃ Space` (IntelliJ IDEA Classic (macOS)), `⌃ Space` (macOS System Shortcuts), `Ctrl+Space` (XWin), `Ctrl+Space` (GNOME), `Ctrl+Space` (KDE), `Alt+/` (Emacs), `Ctrl+Space` (Sublime Text), `⌃ Space` (Sublime Text (macOS)), `Ctrl+Space` (NetBeans), `Ctrl+Space` (Visual Studio), `⌃ Space` (Visual Studio (macOS)), `Ctrl+Space` (Eclipse), `⌃ Space` (Eclipse (macOS)) again.

> **Note:**
> The list of the dependency configurations is provided by Gradle and depends on the plugins listed in the `plugins` section in the `build.gradle.kts`.

3. [Reload](work-with-gradle-projects.html#gradle_refresh_project) your project.

IntelliJ IDEA adds a dependency to the `build.gradle.kts` file.

IntelliJ IDEA also adds the dependency to the Dependencies node in the Gradle  tool window and to the External Libraries in the Project tool window.

![Gradle tool window and Project tool window](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_project_tool_window.png)

If the added dependency has its own transitive dependencies, IntelliJ IDEA displays them in both tool windows. Besides the transitive dependencies, IntelliJ IDEA also indicates cyclic dependencies in the Gradle tool window.

![Gradle tool window: cyclic dependencies](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cyclic_dependencies.png)

If you add a dependency configuration of the [source set](work-with-gradle-projects.html#gradle_source_sets), it will be displayed in the Gradle tool window as well.

![Source set dependency](https://resources.jetbrains.com.cn/help/img/idea/2026.2/source_set_dependency.png)

## View dependencies as a diagram

> **Warning:**
> Make sure you have the bundled Diagrams. Also, make sure you have the Gradle version 4.5.1 or later.

You can work with Gradle dependencies in the diagram format. It might be helpful when you have a large project and want to see the whole picture of how dependencies (including the transitive ones) are connected inside the project.

Procedure:

1. In the Gradle tool window, select a project, on the toolbar, click ![the Show Dependencies icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.fileTypes.diagram.svg) or select the Show Dependencies option from the context menu.

![the Show Dependencies option](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_show_dependencies.png)

You can select the Show Dependencies Popup(`Ctrl+Alt+U` (Windows), `⌘ ⌥ U` (macOS), `⌘ ⌥ U` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ U` (macOS System Shortcuts), `Ctrl+Alt+U` (XWin), `Ctrl+Alt+U` (GNOME), `Ctrl+Alt+U` (KDE), `Ctrl+Alt+U` (Emacs), `Ctrl+Alt+U` (Sublime Text), `⌘ ⌥ U` (Sublime Text (macOS)), `Ctrl+Alt+U` (NetBeans), `Ctrl+Alt+U` (Visual Studio), `⌘ ⌥ U` (Visual Studio (macOS)), `Ctrl+Alt+U` (Eclipse), `⌘ ⌥ U` (Eclipse (macOS))) option to open the graph in a separate window. To close the popup, press `Escape` (Windows), `⎋` (macOS), `⎋` (IntelliJ IDEA Classic (macOS)), `⎋` (macOS System Shortcuts), `Escape` (XWin), `Escape` (GNOME), `Escape` (KDE), `Escape, Escape` (Emacs), `Escape` (Sublime Text), `⎋` (Sublime Text (macOS)), `Escape` (NetBeans), `Escape` (Visual Studio), `⎋` (Visual Studio (macOS)), `Escape` (Eclipse), `⎋` (Eclipse (macOS)).

2. In the diagram window, IntelliJ IDEA displays all project dependencies including the transitive ones.

![Gradle dependencies diagram](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_graph.png)

When you navigate to a dependency in a graph, IntelliJ IDEA displays its version, group and artifact IDs.

![Show dependency information](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_show_dependency_info.png)

Use the diagram window [toolbar](diagram-toolbar-and-context-menu.html) to manage the diagram. You can change the size of a diagram, export it to a file, see only a part of the diagram you are interested in, and so on.

Procedure: Change the visibility level

You can change the visibility level and, for example, view dependencies that have a specific scope (compile, test, and so on).

> **Tip:**
> Hold down `Alt` (Windows), `Alt` (macOS), `Alt` (IntelliJ IDEA Classic (macOS)), `Alt` (macOS System Shortcuts), `Alt` (XWin), `Alt` (GNOME), `Alt` (KDE), `Alt` (Emacs), `Alt` (Sublime Text), `Alt` (Sublime Text (macOS)), `Alt` (NetBeans), `Alt` (Visual Studio), `Alt` (Visual Studio (macOS)), `Alt` (Eclipse), `Alt` (Eclipse (macOS)) and move the caret to zoom in on the parts of the diagram.

> **Note:**
> In Android and Kotlin projects IntelliJ IDEA supports only the default visibility level.

1. In the diagram window, select the project and click ![the Change Visibility Level icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.show.svg).

2. From the list, select the dependency scope you want to see. IntelliJ IDEA displays only the specified dependency scope.

![Changing visibility level](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_visibility_level.animated.gif)

Procedure: Show path from selection to root

You can select dependencies and see how they are connected to the root.

1. In the diagram window, select a dependency for which you want to see the connection to a project. If you want to select several dependencies at once, hold down `Shift` (Windows), `Shift` (macOS), `Shift` (IntelliJ IDEA Classic (macOS)), `Shift` (macOS System Shortcuts), `Shift` (XWin), `Shift` (GNOME), `Shift` (KDE), `Shift` (Emacs), `Shift` (Sublime Text), `Shift` (Sublime Text (macOS)), `Shift` (NetBeans), `Shift` (Visual Studio), `Shift` (Visual Studio (macOS)), `Shift` (Eclipse), `Shift` (Eclipse (macOS)) and make the selection.

2. On the toolbar, click ![the Show Path Root Selection icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.hierarchy.class.svg).

![Show Paths Root Selection](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_show_paths.animated.gif)

Procedure: Show neighbors of the selected nodes

You can select dependencies and see what other dependencies are connected to the selected nodes. It might be helpful if you have a large diagram and want to focus on just a part of it.

1. In the diagram window, select a dependency you need. If you want to select several dependencies at once, hold down `Shift` (Windows), `Shift` (macOS), `Shift` (IntelliJ IDEA Classic (macOS)), `Shift` (macOS System Shortcuts), `Shift` (XWin), `Shift` (GNOME), `Shift` (KDE), `Shift` (Emacs), `Shift` (Sublime Text), `Shift` (Sublime Text (macOS)), `Shift` (NetBeans), `Shift` (Visual Studio), `Shift` (Visual Studio (macOS)), `Shift` (Eclipse), `Shift` (Eclipse (macOS)) and make the selection.

2. On the toolbar, click ![the Show Neighbors of Selected Nodes](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.graph.nodeSelectionMode_dark.svg).

![Show Neighbors of Selected Nodes](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_show_neighbors.animated.gif).

Procedure: Search for a specific dependency in the graph

1. In the diagram window, press `Ctrl+F` (Windows), `⌘ F` (macOS), `⌘ F` (IntelliJ IDEA Classic (macOS)), `⌘ F` (macOS System Shortcuts), `Ctrl+F` (XWin), `Ctrl+F` (GNOME), `Ctrl+F` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+F` (Sublime Text), `⌘ F` (Sublime Text (macOS)), `Ctrl+F` (NetBeans), `Ctrl+F` (Visual Studio), `⌘ F` (Visual Studio (macOS)), `Ctrl+F` (Eclipse), `Ctrl+F` (Eclipse (macOS)) to open the Diagram Elements popup.

![Search for dependency](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_dependency_find.png)

2. Start typing a name of a dependency you want to find, select the one you need from the list of search results and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)). IntelliJ IDEA locates the needed dependency in the graph.

![Found dependency](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_dependency_find_result.png)

Procedure: View the diagram structure

1. Generate a diagram.

2. Click Structure in the left toolbar. IntelliJ IDEA opens the Structure tool window that displays a map of your diagram with a small preview of the selected block and its neighbors.

![the Structure view](https://resources.jetbrains.com.cn/help/img/idea/2026.2/diagram_structure_gradle.png)

Use the context menu to zoom in and out, move canvas, change layout, and export part of the diagram into an image.

![the context menu](https://resources.jetbrains.com.cn/help/img/idea/2026.2/context_menu_gradle.png)

## Dependency analyzer

Gradle dependency analyzer lets you quickly see and analyze resolved dependencies, the unresolved ones, dependencies with conflicts, and transitive dependencies in your project and subprojects.

Procedure: Analyze dependencies

1. On the toolbar in the Gradle tool window, click ![the Analyze Dependencies](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.dependencyAnalyzer.svg).

Alternatively, in the Gradle tool window, right-click the necessary dependency and select Analyze Dependencies from the context menu. You can also right-click a module in the Project view and use the same action.

![Resolved dependencies](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_resolved_dependencies.png)

2. In the Dependency Analyzer window, you can narrow down your analysis scope, check only the conflicted dependencies, or check usages.

If you want to see the required dependency in the `build.gradle` file, right-click the dependency in the Usages part and select Go to Gradle Dependency. If you click Open Gradle Config on the project node, IntelliJ IDEA will open the `build.gradle` file.

If the duplicate dependency is found, it will be greyed out.

For more information about available options and icons in the Dependency Analyzer window, refer to the [reference](#dependency_analyzer_tool_window) section.

### Dependency analyzer tool window reference

| Item | Description |
| --- | --- |
| Scope | You can see scopes in which every dependency is used in the project. To narrow down the list of the dependencies based on their [scope](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#dependency-scope), select the appropriate option from the list of scopes.    ![Dependency analyzer: dependency scope](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_dependency_scope.png)  |
| Show Conflicts Only | Click ![the Conflicts icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.toolwindows.problemsEmpty.svg) to see only unresolved or conflicted dependencies.    ![Dependencies with conflicts](https://resources.jetbrains.com.cn/help/img/idea/2026.2/gradle_conflict_dependencies.png)  |
| Show GroupId | Click ![Show GroupId](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.show.svg) and select Show GroupId to display [GroupId](https://maven.apache.org/guides/mini/guide-naming-conventions.html) in the list of dependencies. |
| Show as Tree | Toggle ![Show as Tree](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.showAsTree.svg) to display the list of dependencies in a form of nodes or in the flat list.   The tree view will help you quickly check the transitive dependencies.    |
| Expand / Collapse | Use ![the Expand All icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.expandAll.svg) / ![the Collapse All icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.collapseAll.svg) expand or collapse the list of dependencies. |

