Maven download and installation
Maven download and installation
1、 Maven concept
Development process: make -- > ant -- > Maven -- > gradle
function
effect
Agreed configuration:
Maven advocates the use of a common standard directory structure. Maven's use convention is better than configuration. We should abide by this directory structure as much as possible:
2、 Using maven
Note: Java environment must be guaranteed before use, otherwise it will fail
download
Official website: http://maven.apache.org/
1. Enter the official website and click download
2. Download the latest version as 3.6 3. Download the latest version and directly click apache-maven-3.6 3-bin. zip
3. To download other versions, click archives below
4. After entering, select the version to download
5. Choose to download maven-3 / 3.6 one
6. Click binaries/
7. Select apache-maven-3.6 1-bin. Zip. After that, get the installation package
install
Select a directory and unzip the downloaded Maven package
Configure Maven warehouse
1. Open conf / settings in this directory XML file
2. Under the Settings tab, add
<localRepository>E:/Maven/repository</localRepository>
Add remote warehouse image
Find the mirrors tag and add it below:
<mirrors>
<!-- 阿里云仓库 -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
</mirrors>
Specifies the JDK version of Maven
Add below the label:
<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>
Configure Maven environment variables
Open the computer's environment variable configuration: right click my computer open properties to open advanced system settings
Find the environment variable settings and click
Click New in the system variable to fill in:
Variable name: maven_ HOME
Variable value: e: \ maven \ apache-maven-3.6 1 is the directory of Maven you unzipped
Next, configure the path: find the path in the system variable, double-click to open it, and then click new add:% Maven_ Home% \ bin, click OK when finished
Verify that Maven configuration is complete
Run CMD with Win + R
Enter MVN - version or MVN - V, and the following shows that Maven has been configured