Как обновить maven intellij idea
Перейти к содержимому

Как обновить maven intellij idea

  • автор:

Maven

On how to install and work with Maven in IntelliJ IDEA, refer to the Maven support section.

If this checkbox is selected, Maven works in the offline mode and uses only the resources that are available locally.

This option corresponds to the —offline command-line option.

Use plugin registry

Select this checkbox to enable referring to the Maven’s Plugin Registry.

This option corresponds to the —no-plugin-registry command-line option.

Execute goals recursively

If this checkbox is selected, the build recurses into the nested projects.

Clearing this checkbox corresponds to the —non-recursive command-line option.

Print exception stack traces

If this option is checked, exception stack traces are generated.

This option corresponds to the —errors command-line option.

Always update snapshots

Select this checkbox, if you want IntelliJ IDEA to update snapshots on sync.

Select the desired level of the output log, which allows plugins to create messages at levels of debug, info, warn, and error, fatal, or disable output log.

Select the desired level of checksum matching while downloading artifacts. You can opt to fail downloading when checksums do not match —strict-checksums , or issue a warning —lax-checksums .

Multiproject build fail policy

Specify how to treat a failure in a multiproject build. You can opt to fail the build:

  • At the very first failure, which corresponds to the command line option —fail-fast .
  • Fail at the end, which corresponds to the command line option —fail-at-end .
  • Ignore failures, which corresponds to the command line option —fail-never .

Plugin update policy

Select plugin update policy from the list.

You can opt for the following:

  • Check for updates, which corresponds to the command line option —check-plugin-updates .
  • Suppress checking for updates, which corresponds to the command line option —no-plugin-updates .

This option is ignored for Maven 3 and later versions.

Threads (-T option)

Use this field to set the -T option for parallel builds. This option is available for Maven 3 and later versions.

For more information, refer to parallel builds in Maven 3 feature.

Maven home path

Use this list to select a bundled Maven version that is available (for Maven3, version 3.0.5 and later) or the result of resolved system variables such as MAVEN_HOME . You can also specify your own Maven version that is installed on your machine. You can click and select the necessary directory in the dialog that opens.

When you open an existing Maven project for the first time, IntelliJ IDEA searches for Maven wrapper defined in .mvn/wrapper/maven-wrapper.properties . If the Maven wrapper is found, it will be used as a Maven home path.

The Maven2 version is not bundled with IntelliJ IDEA. If you need to use it in your project, download and enable the Maven2 support plugin. Then, install the needed Maven version locally.

User settings file

Specify the file that contains user-specific configuration for Maven in the text field. If you need to specify another file, check Override option, click ellipsis button and select the desired file in the Select Maven Settings File dialog.

By default, the field shows the path to the local directory under the user home, that stores the downloads, and contains the temporary build artifacts that you have not yet released. If you need to specify another directory, check the Override option, click ellipsis button and select the desired path in the Select Maven Local Repository dialog. The selected path will be also displayed in the list of the indexed Maven repositories.

Use settings from .mvn/maven.config

Select this option if you want to use a set of Maven options configured in the maven.config file for your project. In this case, options that you have in this file will override the same options specified in the Maven settings.

For example, if you add an option that is a part of the Maven UI settings to the maven.config file, then IntelliJ IDEA will take the value of that option during the next project sync and ignore the one specified in the Maven settings unless the Override checkbox is selected against the options that have this checkbox available.

Maven. Repositories

The table shows the list of Maven repositories, encountered in the current project (including repositories in settings.xml ), with their URLs, type (local or remote) and the date of the most recent update.

If you need to add a Maven repository, use pom.xml . For more information, refer to the Maven documentation.

Indexed Maven Repositories

This area contains Maven repositories that are configured in the Effective POM file which lists the default configurations, profiles and goals. IntelliJ IDEA updates the list of repositories automatically.

If you open a project that contains additional repositories specified, then the repositories are added to the Indexed Maven Repositories list and you can update the indexes.

If you have a problem with your repository, make sure that the indexing service is enabled on the Nexus repository or other repositories you use in your environment.

Click this button to update indexes of the selected repository. It might be helpful in case you expect to get information for newly deployed artifacts such as new versions of libraries that you use in the project. Also, when you use Maven dependencies completion in pom.xml or generation of Maven dependencies using Maven Artifact Search dialog.

Update IntelliJ IDEA

By default, IntelliJ IDEA is configured to check for updates automatically and notify you when a new version is available. Updates are usually patch-based : they are applied to the existing installation and only require you to restart the IDE. However, sometimes patch updates are not available, and a new version of IntelliJ IDEA must be installed.

When IntelliJ IDEA updates to a new major release, it opens the What’s New in IntelliJ IDEA tab in the editor with information about the changes, improvements, and fixes. To open this tab manually, select Help | What’s New in IntelliJ IDEA .

If IntelliJ IDEA does not have HTTP access outside your local network, it will not be able to check for updates and apply patches. In this case, you have to download new versions of the IDE and install them manually as described in Standalone installation.

Toolbox App

If you installed IntelliJ IDEA using the Toolbox App, it will suggest that you update the IDE when a new version is available.

Automatically update all managed tools

Toolbox App menu icon

  1. Open the Toolbox App and click the Toolbox App menu icon in the top right corner.
  2. In the Toolbox App Settings dialog, expand Tools and select Update all tools automatically .

If you disable this option, you will need to click Update next to any instance when a newer version comes out.

You can also configure the update policy for every managed IDE instance separately.

Configure the update policy for a specific instance

  1. Open the Toolbox App, click next to the relevant IDE instance, and select Settings .
  2. In the instance settings dialog, select the update channel to use for this IDE instance:
    • Release : Update only to stable releases that are recommended for production.
    • Early Access Program : Includes updates to release candidates , beta releases, and EAP builds, which are not recommended for production and include feature previews.

Standalone instance

If you installed IntelliJ IDEA manually, the standalone IDE instance will manage its own updates. It will notify you when a new version is available . You can choose to update the current instance, download and install the new version as a separate instance, postpone the notification, or ignore the update entirely.

Platform and Plugin Updates

Configure the update policy

To manage the IntelliJ IDEA update policy, open Settings Control+Alt+S and select Appearance & Behavior | System Settings | Updates .

If the IDE instance is managed by the Toolbox App, these settings will affect only plugin updates.

The Updates page contains the following settings:

Check IDE updates for

Select whether you want IntelliJ IDEA to check for updates automatically and choose an update channel.

  • Early Access Program : Provides all updates, including major version EAP builds and minor version Preview builds. This channel is not recommended for production development. IntelliJ IDEA can be updated only to a minor Preview version, but not to a major EAP build. For example, you can update IntelliJ IDEA 2021.1.1 to 2021.1.2 , but not to 2021.2 EAP . The 2021.2 EAP version in this case will be installed as an additional instance. EAP versions can be updated to both newer EAP and stable IntelliJ IDEA versions. If an EAP version is updated to a stable version at some point, the name of the original installation directory does not change.
  • Beta Releases or Public Previews : Includes stable releases, release candidates, and beta releases. Some updates in this channel may contain minor bugs and feature previews.
  • Stable Releases : Includes only stable releases that are recommended for production.

You can choose the update channel only if you are using a stable version . For EAP builds, the channel is always set to Early Access Program .

Check for plugin updates

Select whether you want IntelliJ IDEA to check for new versions of plugins automatically.

Check for Updates

Check for updates immediately.

Alternatively, go to Help | Check for Updates on Windows or Linux, or IntelliJ IDEA | Check for Updates on macOS.

Manage ignored updates…

Show the list of updates that were ignored. These updates will not be suggested until you remove them from the list of ignored updates.

If you remove several updates from the ignored list, only the most recent will be offered for download when you check for updates.

Show What’s New in the editor after an IDE update

Open a tab with information about new features and improvements after a major IDE update.

Snap package

If you installed IntelliJ IDEA as a snap package, it will manage updates automatically. All snaps are updated automatically in the background every day. You can also get the latest version of all snaps manually at any time by running the following command:

sudo snap refresh

Or if you want to update only the IntelliJ IDEA snap:

Maven

IntelliJ IDEA 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 IntelliJ IDEA 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.

If you want to use a custom Maven version that is not bundled with IntelliJ IDEA, you need to install it locally.

Create a new Maven project

New project Maven

  1. If no project is currently open in IntelliJ IDEA, click New Project on the Welcome screen. Otherwise, select File | New | Project from the main menu.
  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.

Create a new project with Maven archetype

Maven archetype

  1. Launch the New Project wizard. If no project is currently opened in IntelliJ IDEA, click New Project on the welcome screen. Otherwise, select File | New | Project from the main menu.
  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

If you are creating a project using a Maven archetype, IntelliJ IDEA displays the Maven settings that you can use to set the Maven home path and Maven repositories. Also, you can check the archetype properties.

To modify or add archetype catalogs later in your project, refer to the Archetype Catalogs settings.

Create a Java EE project with Maven as a build tool

  1. Launch the New Project wizard. If no project is currently opened in IntelliJ IDEA, 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 . IntelliJ IDEA creates a Maven project with the dedicated Maven tool window and adds necessary dependencies. For the more detailed information, refer to Tutorial: Your first Java EE application.

Open an existing Maven project

  1. Go to File | Open . Alternatively, click Open on the welcome screen. If you have some custom plugins that require you to import your project from the IntelliJ IDEA model, press Control+Shift+A and search for the Project from Existing Sources action.
  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 .

IntelliJ IDEA 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.

If you have a Maven project with the configured Maven wrapper then IntelliJ IDEA will take the Maven version from the maven.properties file and add it as the Maven home path.

Configure the Maven settings before opening a new project

You can configure IntelliJ IDEA 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 IntelliJ IDEA for the first time.) Since these are application-level settings, they are applied to any new project you open.

Maven Settings

  1. On the Welcome screen, select Customize | All Settings . Alternatively, go to File |New Project Setup | Preferences for New Projects .
  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, IntelliJ IDEA displays the Maven Settings dialog where you can specify a location of the local Maven repository and a user settings file.

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 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 IntelliJ IDEA. The multi-module project is defined by a parent POM file with several submodules.

If you have the Maven version 3.7 or later installed, IntelliJ IDEA will support importing a project from the MNG-6656 model.

In this case when you open a child POM file in the editor, you don’t have to specify a version inside the parent tags if it is located in the relativePath by default. If you add a dependency to a module in the same project, you don’t have to specify a version of the dependent module.

  1. Create a Maven parent project. IntelliJ IDEA 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 from the main menu, click 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. IntelliJ IDEA adds the module to the parent project. IntelliJ IDEA also adds name and the description of the subproject to the parent POM. the parent POMIn a multi-module project, the parent POM needs to have a pom packaging. Last, but not least, IntelliJ IDEA adds the description of the parent POM to the subproject’s POM. the subproject POMYou can click 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 ( Control+Alt+S ), go to Build, Execution, Deployment| Maven . Click on the toolbar, in the Maven tool window to access the Maven settings.
  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

The Maven2 version is not bundled with IntelliJ IDEA. If you need to use it in your project, download and enable the Maven2 support plugin.

For a custom version, Download the needed Maven version on your computer.

the Maven settings: Maven home path

  1. From the main menu select File | Settings | 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.
  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.

Project Structure dialog / Project page

  1. Go to File | Project Structure Control+Alt+Shift+S .
  2. In the dialog that opens, in Project SDK , specify the JDK version and click OK to save the changes.

Change the JDK version for the Maven runner

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

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

Maven Settings / Runner page

  1. In the Settings dialog ( Control+Alt+S ), go to Build, Execution, Deployment | Maven | Runner .
  2. On the page that opens, in the JRE field, select the JDK version.

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.

Maven Settings / Importing page

  1. In the Settings dialog ( Control+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.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *