> 文档中心 > 杨校老师课堂之Maven下载与配置阿里云镜像

杨校老师课堂之Maven下载与配置阿里云镜像


1. 下载

下载地址:

https://archive.apache.org/dist/maven/maven-3/

建议:

  1. 不要存放在C盘内;
  2. 不要存放在桌面
  3. 不要存放在有中文路径中或存放在带有特殊字符的路径中
  4. 建议放在D盘develop/apache/maven下
    在这里插入图片描述

2. 配置

修改配置文件settings.xml

  • 2.1 修改本地仓库的位置
<localRepository>D:/repo</localRepository>
  • 2.2 修改本地镜像下载源为阿里云
 <mirror>      <id>alimaven</id>      <name>aliyun maven</name>      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>      <mirrorOf>central</mirrorOf>     </mirror>

3. IntellJ IDEA配置Maven

  1. 启动idea软件,在settings内
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

  2. 完成
    最后单击 Apply(应用) ,再点击OK即可!



修改后的整篇示例:

<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   /path/to/local/repo  -->      <!-- 2. CentOS系统内可以设置在   /usr/local/repo--> <localRepository>D:/repo</localRepository>  <!-- interactiveMode   | This will determine whether maven prompts you when it needs input. If set to false,   | maven will use a sensible default value, perhaps based on some other setting, for   | the parameter in question.   |   | Default: true  true  -->  <!-- offline   | Determines whether maven should attempt to connect to the network when executing a build.   | This will have an effect on artifact downloads, artifact deployment, and others.   |   | Default: false  false  -->    <pluginGroups>    <!-- pluginGroup     | Specifies a further group identifier to use for plugin lookup.    com.your.plugins    -->  </pluginGroups>    <proxies>    <!-- proxy     | Specification for one proxy, to be used in connecting to the network.     |          optional      true      http      proxyuser      proxypass      proxy.host.net      80      local.net|some.host.com        -->  </proxies>    <servers>    <!-- server     | Specifies the authentication information to use when connecting to a particular server, identified by     | a unique name within the system (referred to by the 'id' attribute below).     |     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are     |used together.     |          deploymentRepo      repouser      repopwd        -->    <!-- Another sample, using keys to authenticate.          siteServer      /path/to/private/key      optional; leave empty if not used.        -->  </servers>    <mirrors>    <!-- mirror     | Specifies a repository mirror site to use instead of a given repository. The repository that     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.     |          mirrorId      repositoryId      Human Readable Name for this Mirror.      http://my.repository.com/repo/path         -->      <mirror>      <id>alimaven</id>      <name>aliyun maven</name>      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>      <mirrorOf>central</mirrorOf>     </mirror>  </mirrors>    <profiles>    <!-- profile     | Specifies a set of introductions to the build process, to be activated using one or more of the     | mechanisms described above. For inheritance purposes, and to activate profiles via      | or the command line, profiles have to have an ID that is unique.     |     | An encouraged best practice for profile identification is to use a consistent naming convention     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.     | This will make it more intuitive to understand what the set of introduced profiles is attempting     | to accomplish, particularly when you only have a list of profile id's for debug.     |     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.          jdk-1.4       1.4                jdk14   Repository for JDK 1.4 builds   http://www.myhost.com/maven/jdk14   default   always               -->    <!--     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration     | might hypothetically look like:     |     | ...     |      |   org.myco.myplugins     |   myplugin     |     |        |     ${tomcatPath}     |        |      | ...     |     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to     |anything, you could just leave off the  inside the activation-property.     |          env-dev          target-env   dev              /path/to/tomcat/instance              -->  </profiles>  <!-- activeProfiles   | List of profiles that are active for all builds.   |      alwaysActiveProfile    anotherAlwaysActiveProfile    --></settings>

作者: 杨校

出处: https://mryang.blog.csdn.net

分享是快乐的,也见证了个人成长历程,文章大多都是工作经验总结以及平时学习积累,基于自身认知不足之处在所难免,也请大家指正,共同进步。

本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出, 如有问题, 可邮件(397583050@qq.com)咨询

ZDfans