1. Why should we learn Maven?
1. In JavaWeb development, we need to use a lot of jar packages, which we used to import manually;
2. How can one thing automatically help us import and configure this jar package;
thus, Maven was born!
Second, the Maven project architecture management tool
we currently use is to facilitate the import of jar packages!
The core idea of Maven: Convention is greater than configuration, there are constraints, don't violate it.
Maven will prescribe how you should write our Java code, and you must follow this specification;
3. Download and install the Maven
official website: http://maven.apache.org/
click Download on the left,
Scroll down the webpage and click to download apahce-maven-3.6.3-bin.zip.
After the download is complete, unzip it. I unzip it to the d:\tools\maven directory, as shown in the following figure:
Fourth, configure the environment variables
in our system environment variables, configure:
- M2_HOME: bin directory under the maven directory
- MAVEN_HOME: maven directory
- Configure %MAVEN_HOMOE%\bin in the system path
After restarting the computer, test whether Maven is installed successfully and ensure that it must be configured!
5. Modify the mirror to ensure the download speed.
Modify the settings.xml file and add the Aliyun mirror inside. It is
recommended to search for the Aliyun mirror address on Baidu:
<mirror>
<id>aliyun</id>
<mirrorOf>central</mirrorOf>
< name>aliyun Maven</name>
<url> http://maven.aliyun.com/nexus/content/groups/public/</url> ;
</mirror>
VI.
Establish a local warehouse D:\tools first create a mavenRepo folder, then modify the settings.xml file and add:
<localRepository>D:/tools/mavenRepo</localRepository> The
location is as shown in the figure below: