Apache-maven
第一步
下载Apache-maven-3.5:
链接:https://pan.baidu.com/s/1f41Uc76grn2Wa8P2KKGEdw
提取码:7pls

第二步
环境配置:
我的电脑>>属性>>高级系统设置>>环境变量设置: 如下

Apache-maven 在eclipse中配置问题

路径配置:系统变量>>path>>编辑
Apache-maven 在eclipse中配置问题

编辑后>>新建>>添加路径名(apache-maven-版本号\bin)可以直接复制你apache-maven下bin的路径 直接粘贴也行。(记得确定)

Apache-maven 在eclipse中配置问题
检查环境是否配置成功:打开cmd 运行mvn -v 如下图:就表示配置成功:

Apache-maven 在eclipse中配置问题
在eclipse里配置maven:
配置Maven本地仓库
在E盘目录下新建maven-repositor2文件夹,该目录用作maven的本地库。
找到apache-maven-3.5.0下的conf下的settings.xml,用编辑器打开
找到localRepository,修改如下:

<localRepository>E:\maven_repositor2</localRepository>

配置中央镜像:
找到

  <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.
         |
        <mirror>
          <id>mirrorId</id>
          <mirrorOf>repositoryId</mirrorOf>
          <name>Human Readable Name for this Mirror.</name>
          <url>http://my.repository.com/repo/path</url>
        </mirror>
         -->
      </mirrors>

在mirrors中添加如下代码(阿里云镜像):

 <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
 </mirror>  

改完记得保存.

cmd 运行mvn help:system(就会下载一推东西)

结束后你的本地仓库会多很多东西如下图:
Apache-maven 在eclipse中配置问题

接下里就去eclipse去配置:
eclipse>>window>>preferences(属性)>>Maven>>installations>>add>>extranal>>Directory(找到maven的位置)>>finish
Apache-maven 在eclipse中配置问题
选中maven>>apply
Apache-maven 在eclipse中配置问题

相关文章: