troubled

Intellij Idea is a very powerful editor, which can easily help us to create maven projects. However, we often have a problem, that is, when creating maven projects with IDEA, the speed is very slow, often takes several minutes, and sometimes even gets stuck. The main reason is that when creating maven project, the default is to download a file named archetype-catalog.xml from the network. The file size is 5-6m, and the download speed is very slow, resulting in a very slow creation process.

The solution

There are three solutions, all of which require configuring maven’s VM Options parameters.

Methods a

Add -darcheTypecatalog =internal to maven VM Options as follows:

The idea startup page is displayed, and the global Settings are displayed

Method 2

Download archetype-catalog. XML and add -darcheTypecatalog =local to Maven VM Options

By default, the maven project is created by downloading the catalog file from the web. You can download the catalog file locally and set archetype to local so that you don’t have to download it from the web every time.

Steps:

Download archetype-catalog. XML file to your local PC.

The location of the file is http://repo1.maven.org/maven2/archetype-catalog.xml, but direct access cannot be download, I put the file on the lot, needy students can click on the download.

Github.com/Taoxj/sc_pr…

2. Download the file and put it to the corresponding location in the local warehouse

The location of maven’s local repository depends on the configuration in settting.xml, for example, my setting.xml repository is D:\apache-maven-3.6.0\repository

3. Modify VM Options for Maven

As with the previous method, open the Maven Settings bar in Global Settings and fill in the VM Options input box

-DarchetypeCatalog=local
Copy the code

This way maven will get the catalog file locally every time, so you won’t have to wait so long to create the project.

Methods three

In maven VM Options plus – Dmaven. MultiModuleProjectDictory = $MAVEN_HOME parameters, MAVEN_HOME is configure maven environment in your environment variable name

tips

Above is several solutions to slow idea to create a maven project, worth, three kinds of solutions are not effective, for example, the author tried before two kinds of schemes, found that the computers of the company will be successful, but my home computer doesn’t work, then I try again and the third way, found or failure, checked the online just know, It turns out that the JDK and Maven versions are incompatible.

Both computers have JDK version 1.8, but my company computer has Maven version 3.5 installed, while my personal computer has Maven version 3.3 installed, so I also installed Maven version 3.5 on my personal computer, and tried the third solution again. The result was actually successful. After excitement, I tried the first two solutions on my personal computer, but they still failed to solve the problem. I still don’t know what caused the problem until now, but I can only study later.

As a final tip, you can try the first two options first, because once and for all, you don’t need to configure parameters when creating a project, and if that doesn’t work, you can use the third option.