Skip to content

03、Maven下载与阿里云镜像加速

1、Maven下载

官网:https://maven.apache.org/

下载:https://maven.apache.org/download.cgi

2、阿里云镜像加速

xml
<?xml version="1.0" encoding="utf-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  
  <!-- localRepository
 | The path to the local repository maven will use to store artifacts.
 |
 | Default: ${user.home}/.m2/repository
 <localRepository>${user.home}/.m2</localRepository>
用户目录下的.m2是所有jar包的地方; maven容器内jar包的位置
 -->  
  <!--<localRepository>/var/jenkins_home/appconfig/maven/.m2</localRepository>-->
  <pluginGroups></pluginGroups>  
  <proxies></proxies>  
  <servers></servers>  
  <mirrors> 
    <mirror> 
      <id>nexus-aliyun</id>  
      <mirrorOf>central</mirrorOf>  
      <name>Nexus aliyun</name>  
      <url>http://maven.aliyun.com/nexus/content/groups/public</url> 
    </mirror> 
  </mirrors>  
  <profiles> 
    <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> 
  </profiles> 
</settings>

3、Maven配置环境变量

和JDK类似

配置MAVEN_HOME

配置PATH %MAVEN_HOME%\bin

sh
mvn -v

4、IDEA配置Maven的settings文件

image-20250728162302247