Write custom directory title here
In fact, the maven version is almost the same, so don’t leave if you click on it
foreword
2023年05月06日
Apache Maven 3.9.1 is the latest version recommended for all users.
The Apache Maven team maintains the latest version of the last two series of GA releases.
3.9.1
Currently, the plugin provides Maven API compatibility down to 3.2.5.
The date format is: YYYY-MM-DD
issue date | Version | required java version |
---|---|---|
2023-03-14 | 3.9.1 | Java 8 |
1. Download Apache Maven 3.9.1
1.1. Please check whether your IDEA has this condition and is compatible
1.2, Maven download
Binary is an executable version that has been compiled and can be used directly. Source is the source code version, which needs to be compiled into executable software before it can be used.
Windows
Maven
Select Binary zip archive usingapache-maven-3.9.1-bin.zip
Two, Windows installation and configuration Maven
2.1, decompression
Unzip the downloaded file into the directory you set
路径中不要有中文等影响环境的字符
2.2. Create a new repository local warehouse
repository
Create a new folder named in its directory ,
the purpose of this folder is to use it as a local Maven warehouse
2.3, configure environment variables
win11:搜索窗口 ---> 编辑系统环境变量--->环境变量--->系统变量(S)--->新建
MAVEN_HOME software path
变量名:MAVEN_HOME
变量值:D:\software\apache-maven-3.9.1\repository
//此处的变量值为你存放Maven的解压路径
M2_HOME local warehouse path
变量名:M2_HOME
变量值:D:\software\apache-maven-3.9.1\repository
//此处的变量值为你存放Maven的解压后目录中的文件夹的路径
Configure Path
%MAVEN_HOME%\bin
攻城狮
Please go to directory three:Maven配置阿里云等镜像
2.3.1 Friendly icons for newcomers
Create a new MAVEN_HOME
Create a new M2_HOME
Open the Path variable
Input content
%MAVEN_HOME%\bin
After confirming that there is no error, confirm - close all windows
3. Configure the settings.xml file
Open the file conf
under the decompression pathsettings.xml
3.1. Configure the local warehouse address
Find the node localRepository and
configure the local address
As shown in the code,填写自己的本地仓库地址
<localRepository>D:\software\apache-maven-3.9.1\repository</localRepository>
3.2. Configure images such as Maven and Alibaba Cloud
3.2.1. Search mirrors
, add Alibaba Cloud image to this object
<!-- 阿里云spring仓库 -->
<mirror>
<id>aliyunmaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun central maven</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
3.3. Maven configures JDK (it is not recommended to configure here, just configure different jdk for each project)
My code compilation error reported here, and I commented it out.
<!-- java版本 -->
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
4. Test whether maven is installed successfully
- win + r open cmd
- Enter mvn -v to view the version
- mvn help:system update initialization dependencies
The test configures the mirror address successfully
The test version was successful
5. IDEA maven configuration
This is for my sake, IDEA 2022.2.4 recommends maven 3.8.1,
I will reinstall one according to this