Aqua 2024.3 Help

Maven refactorings

Aqua 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.

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

    POM with the dependency example
  2. Press Ctrl+Alt+M or select Refactor | Extract | Extract Managed Dependency.

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

    parent POM with extracted dependency

    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.

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

    POM with dependencies with the same version
  2. Press Ctrl+Alt+V or select Refactor | Property.

  3. In the Introduce Property dialog, specify a name of the property and name of the POM and click OK.

    the Introduce property dialog
  4. Aqua creates a properties section with a new declaration and replaces the content of the selected dependency.

    POM with the declared property
  5. If Aqua encounters more than one occurrence, it displays them in the Find tool window where you can manage their replacement.

    the Find tool window

    Click Replace All to replace all the dependencies' versions.

    POM with changed versions

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 Aqua.

Project

Select the pom.xml where the new property will be declared.

Last modified: 11 July 2024