Aqua Help

Maven projects

Aqua lets you manage Maven projects. You can link, ignore projects, synchronize changes in Maven and Aqua projects, and configure the build and run actions.

  1. In the Maven tool window, right-click a linked project.

  2. From the context menu, select Jump to Source F4.

    Aqua navigates to the appropriate Maven configuration file, and the related POM opens in the editor.

Ignore a Maven project

You can deactivate a Maven project using the Ignore Projects option. In this case, Aqua keeps the ignored Maven projects and subprojects in the Maven tool window, but stops their import (modules, content roots, goals, and so on) to the project. However, Aqua synchronizes the ignored projects with the current one. It might be helpful when you work with a project that has multiple subprojects and need to skip irrelevant ones.

  1. In the Maven tool window, right-click the project that you want to ignore.

  2. From the context menu, select Ignore Project.

  3. In the window that opens, click Yes if you want to remove the project from the Projects tool window.

If you want to activate your Maven projects or subprojects, select Unignore Projects from the context menu.

Ignore POM of a linked project from the Maven settings

You can ignore a POM file using the Ignored Files settings.

  1. In the Settings dialog (Ctrl+Alt+S) , go to Build, Execution, Deployment | Build Tools | Maven | Ignored Files.

  2. On the Ignored Files page, select a POM you want to ignore and click OK to save the changes.

    Maven Settings
  3. Aqua displays a dialog where you can either remove or leave the selected POM file in the Project tool window.

    Reload Maven project

    If you keep the ignored file in the Project tool window, the POM will be displayed as ignored however you can still work with the file and modify it in the editor.

    Project tool window

Reload a Maven project

Every time you manually change the pom.xml file in the editor, you need to load the changes. Aqua displays a notification icon in the right part of the editor suggesting to Load Maven Changes made to the project (Ctrl+Shift+O).

If you want to control the importing process of your project, you can manually trigger the action.

  1. In the Maven tool window, right-click a linked project.

  2. From the context menu, select Reload project the Reload project icon.

    On invoking this action, Aqua parses the project structure in the Maven tool window.

    Aqua cannot reload just a part of your project, it reloads the whole project including subprojects and dependencies.

    If you configure a dependency through the Project Structure dialog (Ctrl+Alt+Shift+S), the dependency will only appear in the Aqua Project tool window, not in the Maven tool window. Note that the next time you reload your project, Aqua will remove the added dependency since Aqua considers the Maven configuration as a single source of truth.

Configure the auto-reload

  1. In the Settings dialog (Ctrl+Alt+S) , go to Build, Execution, Deployment | Build Tools.

    Alternatively, In the Maven tool window, click Build Tools Settings and select the Auto-Reload Settings option.

    the Maven tool window
  2. In the Build tools settings, specify the following options:

    the Build Tools settings
    • Reload changes in the build scripts: this option is selected by default. If you want to disable the auto-reload and manually control the reloading process, unselect this checkbox.

    • Any changes: select this option if you want to automatically reload the project after any changes you make to pom.xml or external changes.

      Every time you manually change the Maven build script in the editor, you need to load the changes. Aqua displays a notification icon in the right part of the editor suggesting to Load Maven Changes made to the project (Ctrl+Shift+O). With the Any changes option, Aqua reloads all the changes automatically.

    • External changes: when you select this option, Aqua automatically reloads the project only after the VCS changes and changes made to the build files outside the IDE.

Add a Maven config file to a Maven project

If you want to add files such as maven.config or jvm.config, you can do so by creating an empty file in the project.

  1. In the Project tool window, right-click a directory where you want to create a file.

  2. In the context menu, select New | File.

  3. In the dialog that opens, enter a name of the file (maven.config or jvm.config) and click OK.

    When you import your project, Aqua reads a content located in the maven.config file, but keep in mind that the content of the jvm.config is ignored.

    For more information about the Maven config files, refer to https://maven.apache.org/configure.html.

You can have multiple Maven projects inside one Aqua project. It might be helpful if you keep parts of code in different projects or have some legacy projects on which you need to work. You can link such projects in Aqua and manage them simultaneously. You can also quickly remove such projects from the Maven structure.

  1. Open the Maven tool window.

  2. In the Maven tool window, click the Link Maven Projects icon to attach a Maven project.

  3. In the dialog that opens, select the desired pom.xml file, and click OK.

    The project is linked. The Maven tool window shows the toolbar and a tree view of Maven entities.

When you unlink a Maven project, Aqua removes all relevant projects and content roots, removes the Maven project from both the Maven tool window and the Project tool window, and stops its synchronization. It might be helpful if you need to fully remove the previously linked Maven project from the current Aqua project.

  1. In the Maven tool window, right-click a linked project.

  2. From the context menu, select Unlink Maven Projects (Delete). Alternatively, you can select the linked project and click the Remove icon on the tool window's toolbar.

  3. Click OK.

Delegate build and run actions to Maven

By default, Aqua uses the native Aqua builder to build a Maven project. It might be helpful if you have a pure Java or a Kotlin project since Aqua supports the incremental build which significantly speeds up the building process. However, if you have a configuration that changes the compilation on the fly, or your build generates an artifact with a custom layout, then Maven is preferable for the building process.

Build a project with Maven

  1. Click Maven settings in the Maven tool window. Alternatively, from the main menu select File | Settings | Build, Execution, Deployment |Build Tools | Maven.

  2. Click Maven and from the list, select Runner.

  3. On the Runner page, select Delegate IDE build/run actions to maven.

    Maven Settings / Runner page
  4. Click OK.

  5. In the main menu, go to Build | Build Project Ctrl+F9. Aqua invokes the appropriate Maven goals.

  6. Click the Build icon on the status bar to view the results of the sync in the Build tool window.

    Build tool window

Run and debug with Maven

When the Delegate IDE build/run actions to maven is selected, Aqua runs and debugs your code using Maven. HotSwap is also gets triggered, and the classes are reloaded during a debugging process.

You can use regular run and debug actions as you use in any other projects.

  1. Depending on what action you want to use, from the main menu, select Run | Run or Run | Debug.

  2. Check the results in the Run tool window or in the Debug tool window if you are debugging your code. For example, when you run the main method Ctrl+Shift+F10 in your Java project, Aqua uses Maven to run the class.

    Run tool window
Last modified: 07 March 2024