Aqua Help

Maven

Aqua supports a fully-functional integration with Maven that helps you automate your building process. You can easily create a new Maven project, open and sync an existing one, add a Maven support to any existing Aqua project, configure and manage a multi-module project.

You can also create a Maven project and store it in the WSL environment or open it from the WSL file system. For more information, refer to the WSL section.

Create a new Maven project

  1. If no project is currently open in Aqua, click New Project on the Welcome screen. Otherwise, select File | New | Project from the main menu.

    New project Maven
  2. Name the new project and change its location if necessary.

  3. Select the Create Git repository to place the new project under version control.

    You will be able to do it later at any time.

  4. Select a language that you want to use in your project. Click if you want to add other languages available via plugins.

  5. Select Maven in the list of Build system.

  6. Specify project's SDK (JDK) or use the default one.

  7. The selected Add sample code option will create a file with a basic code sample.

  8. In Advanced Settings, specify the following Maven coordinates that are added to the pom.xml file:

    • GroupId - a package of a new project.

    • ArtifactId - a name of your project.

    For more information about Maven coordinates, refer to Maven naming conventions.

  9. Click Create.

    Aqua creates a Maven project with the pom.xml file that includes compiler and target versions of Java, the dedicated Maven tool window, and all the necessary dependencies to start your work.

Create a new project with Maven archetype

  1. Launch the New Project wizard. If no project is currently opened in Aqua, click New Project on the welcome screen. Otherwise, select File | New | Project from the main menu.

    Maven archetype
  2. Select Maven Archetype from the options on the left.

  3. Using options on the right, configure your project:

    • Name: specify the name of your project.

    • Location: specify the location of your project.

    • Create Git repository:

      Select the Create Git repository to place the new project under version control.

      You will be able to do it later at any time.

    • JDK: specify project's SDK (JDK) or use the default one.

    • Catalog: specify which Maven repository you want to use in your project.

      The internal Maven catalog is a default one. You can also select the local repository that is located in the .m2 directory, or you can select Maven central repository.

      You can also click Manage Catalogs and add a custom repository if you need.

    • Archetype: select the needed Maven archetype. Click Add to specify the custom archetype.

    • Version: the version is specified automatically.

    • Additional properties: add additional properties

Create a Java EE project with Maven as a build tool

  1. Launch the New Project wizard. If no project is currently opened in Aqua, click New Project on the welcome screen. Otherwise, select File | New | Project from the main menu.

  2. Select Jakarta EE from the list of generators.

  3. Leave the default option Maven as your build tool system.

  4. Select additional libraries and frameworks.

  5. Specify your project's name, location, and artifact coordinates. Click Create.

    Aqua creates a Maven project with the dedicated Maven tool window and adds necessary dependencies.

Open an existing Maven project

  1. Go to File | Open.

    Alternatively, click Open on the welcome screen.

  2. In the dialog that opens, select the pom.xml file of the project you want to open.

    Click OK.

  3. In the dialog that opens, click Open as Project.

Aqua opens and syncs the Maven project in the IDE. If you need to adjust importing options when you open the project, refer to the Maven settings. For example, if you have Maven options configured in the maven/config file and want to use them in your project, select the Use settings from .mvn/maven.config option in the Maven setting.

Configure the Maven settings before opening a new project

You can configure Aqua to display Maven settings before you open a new Maven project. (A new Maven project in this case is the existing project that you open in Aqua for the first time.) Since these are application-level settings, they are applied to any new project you open.

  1. On the Welcome screen, select Customize | All Settings.

    Alternatively, go to File |New Project Setup | Preferences for New Projects in the main menu.

  2. In the Settings dialog, select Build, Execution, Deployment | Build Tools | Maven.

  3. In the Maven settings dialog, select the Show settings dialog for new Maven projects.

  4. Click OK to save the changes.

    Next time you open a new project, Aqua displays the Maven Settings dialog where you can specify a location of the local Maven repository and a user settings file.

    Maven Settings

Add a new Maven module to an existing project

You can add a Maven module to the project in which you are already working.

  1. In the Project tool window, right-click the project folder and select New | Module. Alternatively, go to File| New | Module in the main menu to open the New Module wizard.

  2. If you used the main menu to add a module, then the process of adding a module is the same as Creating a new Maven project.

    If you are adding submodules by right-clicking the root folder then the process of adding a new module is shorter. You need to specify the name of your module in the Name field. The rest of the information is added automatically, and you can use either the default settings or change them according to your preferences.

Configure a multi-module Maven project

You can create a multi-module Maven project in Aqua. The multi-module project is defined by a parent POM file with several submodules.

  1. Create a Maven parent project. Aqua creates a standard Maven layout including an src folder.

  2. In the Project tool window, remove the src folder since you would only need it in the very rare cases. For your general project, you don't need the src folder for the parent POM.

  3. In the Project tool window, right-click your project (or in the main menu, go to File) and select New | Module to add a subproject.

  4. In the New Module wizard following the instructions on how to add a module, specify the necessary information and click Finish.

    The src folder is created automatically, and you can open POM and add a packaging that you need. Aqua adds the module to the parent project. Aqua also adds name and the description of the subproject to the parent POM.

    the parent POM

    Last, but not least, Aqua adds the description of the parent POM to the subproject's POM.

    the subproject POM

    You can click the Parent POM icon in the left gutter to quickly open the parent POM from your subproject.

  5. You can also add dependencies to the parent POM that will be inherited by the subprojects.

    Parent POM: added dependency
  6. Open Maven tool window to see that all changes made in the parent POM are reflected in subprojects.

    the Maven tool window

Access the Maven settings

Use the Maven settings to configure options such as Maven version, local repository, offline mode, and so on.

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

  2. On the Maven settings page, configure the available options and click OK to save the changes.

Use the Maven wrapper or a custom version of Maven

  1. Press Ctrl+Alt+S to open the IDE settings and then select Build, Execution, Deployment | Build Tools | Maven.

  2. On the Maven settings page, in the Maven home path field, specify the location of the Maven custom version installation. For the Maven wrapper, select the use Maven wrapper option from the list. In this case the version of Maven defined in the .mvn/wrapper/maven-wrapper.properties file will be used.

    the Maven settings: Maven home path
  3. Click OK.

Change the JDK version in a Maven project

There are several places where you can change the JDK version that will affect not only your current project, but the whole application as well.

Change the JDK version in the Project Structure

Changing the JDK version in the Project Structure dialog will only affect the current project.

  1. In the main menu, go to File | Project Structure Ctrl+Alt+Shift+S.

  2. In the dialog that opens, in Project SDK, specify the JDK version and click OK to save the changes.

    Project Structure dialog / Project page

Change the JDK version for the Maven runner

When Aqua runs Maven goals, it will use the JDK version specified for the Maven runner. By default, Aqua uses the project's JDK.

Changing the JDK for the Maven runner will only affect the current project.

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

  2. On the page that opens, in the JRE field, select the JDK version.

    Maven Settings / Runner page

Change the JDK version for the Maven importer

Changing the JDK version for the Maven importer will affect the whole application since it is a part of the Maven global settings. If you want to use the same JDK version as you use in your project for syncing or resolving dependencies, change the JDK version for the importer.

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

  2. On the page that opens, in the JDK for importer field, select the same JDK version as you used in the Project Structure and click OK to save the changes.

    Maven Settings / Importing page
Last modified: 07 March 2024