# Maven refactorings

IntelliJ IDEA lets you use several extract refactorings while you work in your POM. For example, you can extract a dependency definition into a parent POM if you have a multi-module project. You can also extract a repeatable content of dependencies into a property to eliminate duplicates.

## Extract managed dependency

Let's say you have a multi-module project and in one of subprojects you have defined several dependencies that can be used by other subprojects.

You can use Extract managed dependency refactoring to extract such dependency into a parent POM under `dependencyManagement`.

Procedure:

1. In your POM, select the dependency you want to extract.

![POM with the dependency example](https://resources.jetbrains.com.cn/help/img/idea/2026.2/maven_depen_extract.png)

2. Press `Ctrl+Alt+M` (Windows), `⌘ ⌥ M` (macOS), `⌘ ⌥ M` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ M` (macOS System Shortcuts), `Ctrl+Alt+M` (XWin), `Ctrl+Alt+M` (GNOME), `Ctrl+Alt+M` (KDE), `Ctrl+Alt+M` (Emacs), `Ctrl+Alt+M` (Sublime Text), `⌘ ⌥ M` (Sublime Text (macOS)), `Alt+Shift+M` (NetBeans), `Ctrl+R, M` (Visual Studio), `⌘ R, M` (Visual Studio (macOS)), `Alt+Shift+M` (Eclipse), `⌘ ⌥ M` (Eclipse (macOS)) or select `Refactor | Extract | Extract Managed Dependency`.

3. IntelliJ IDEA extracts the selected dependency into a parent POM, automatically creating a `dependencyManagement` section and a full dependency definition.

![parent POM with extracted dependency](https://resources.jetbrains.com.cn/help/img/idea/2026.2/parent_pom_with_extraction.png) Use gutter icons to see a popup with dependency descriptions or to navigate between parent and subprojects' dependencies.

## Introduce property

Let's say you have a bunch of dependencies that have the same `version`.

You can use the Introduce Property refactoring to introduce a property into the `properties` section to manage it in one place.

Procedure:

1. In your POM, select an item (in our case `version`) you want to extract.

![POM with dependencies with the same version](https://resources.jetbrains.com.cn/help/img/idea/2026.2/maven_extract_property.png)

2. Press `Ctrl+Alt+V` (Windows), `⌘ ⌥ V` (macOS), `⌘ ⌥ V` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ V` (macOS System Shortcuts), `Ctrl+Alt+V` (XWin), `Ctrl+Alt+V` (GNOME), `Alt+Shift+V` (KDE), `Ctrl+Alt+V` (Emacs), `Ctrl+Alt+V` (Sublime Text), `Ctrl+Alt+V` (Sublime Text (macOS)), `Alt+Shift+V` (NetBeans), `Ctrl+R, V` (Visual Studio), `⌘ R, V` (Visual Studio (macOS)), `Alt+Shift+L` (Eclipse), `⌘ ⌥ L` (Eclipse (macOS)) or select `Refactor | Property`.

3. In the [Introduce Property](#introduce-property-dialog) dialog, specify a name of the property and name of the POM and click OK.

![the Introduce property dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/maven_introduce_property.png)

4. IntelliJ IDEA creates a `properties` section with a new declaration and replaces the content of the selected dependency.

![POM with the declared property](https://resources.jetbrains.com.cn/help/img/idea/2026.2/maven_extract_property_result.png)

5. If IntelliJ IDEA encounters more than one occurrence, it displays them in the [Find](find-tool-window.html) tool window where you can manage their replacement.

![the Find tool window](https://resources.jetbrains.com.cn/help/img/idea/2026.2/maven_find_occurrences.png) Click Replace All to replace all the dependencies' versions.

![POM with changed versions](https://resources.jetbrains.com.cn/help/img/idea/2026.2/maven_extract_property_result_pom.png)

## Introduce Property dialog

Use this dialog to specify options for the Introduce Property refactoring.

| Item | Description |
| --- | --- |
| Name | In this field, specify the name you want to assign to a new property. You can either type this name manually or select one of the values suggested by IntelliJ IDEA. |
| Project | Select the `pom.xml` where the new property will be declared.  |

## See also

### How tos

[Maven dependencies in a multi-module
project](work-with-maven-dependencies.html)

