In the process of writing code, I always had a headache navigating new projects, which urged me to use Maven as a project management tool. Next, we summarize the whole process of configuring Maven in IDEA.
Configure Maven
Maven is a very convenient project management tool, with self-built local library and domestic mirror to use the speed is also improved, can greatly reduce our usual project when guide package trouble.
Maven download and installation
Maven configuration is relatively simple, similar to Java configuration. The first step is to download the Maven compressed package from the official website, as shown below
Path
bin
mvn -v
Set up Maven to use mirrors and local repositories
Setting Maven is done by modifying its built-in setting. XML file by opening the Maven folder ->config folder -> using the editor to open setting.xml. Maven’s own image is extremely slow to use in China, so first we set the download image to be a domestic image, and insert the following code around line 159 in setting.xml:
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
Copy the code
Next, set up Maven to use a local repository to speed up its startup. First, download the repository where most of the common packages have been added and place the link here
Link: pan.baidu.com/s/1qYxwyz8Q… Extraction code: JUGC
After downloading, add the location of the local repository in the setting. XML file around line 55, as shown below
<localRepository>F: \ code \ apache maven - 3.6.3 \ repository</localRepository>
Copy the code
This completes Maven’s basic setup.
Settings in IDEA
After the basic setup of Maven, you need to set up IDEA before you can start creating the project.
Setting the Maven Path
IDEA itself seems to already have a Maven version, just like the built-in JDK, which we will now change to the version we downloaded ourselves. Click on File->Other Settings->Settings for New Projects-> In Build Tools to find Maven and modify the location of the installation directory, Settings, and repository
Creating a New Maven Project
With the setup complete, it’s finally time to create a new Maven project! When creating a new project, select the Maven template shown below
The above is the whole process of configuring Maven in IDEA and creating a project. It is really convenient to use. I hope you can get started quickly.