Windows中Maven整合到Eclipse,修改成国内镜像

  Java项目中,当只使用几个jar包时,很好管理。当使用了好几十个时,jar包的版本、相互之间的依赖等,管理起来就不是很方便。

Maven最直观的就是jar包的依赖管理,当然他的使用不仅仅是这些,也不仅仅是使用在Java上。下面是在Eclipse里面整合Maven,

自定义本地仓库位置,镜像等。

  1、下载Maven,下载地址:http://maven.apache.org/download.cgi

2、下载后,解压即可

3、复制Maven的bin路径,添加到环境变量

4、打开高级系统设置

5、添加路径到环境变量的“Path”,依次点击”确定“以保存

6、验证Maven配置,按”Win+r“,打开命令行提示

7、输入“mvn -v”,验证

8、编辑Maven的配置文件,“conf”下的“settings.xml”

9、配置本地仓库位置

10、设置远程仓库的镜像(网速的问题),使用阿里云镜像

10.1、代码1

    <mirror>
      <id>nexus-aliyun</id>
      <mirrorOf>central</mirrorOf>
      <name>Nexus aliyun</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
    <mirror>
      <id>nexus-aliyun-thirdparty</id>
      <mirrorOf>thirdparty</mirrorOf>
      <name>Nexus aliyun thirdparty</name>
      <url>http://maven.aliyun.com/nexus/content/repositories/thirdparty/</url>
    </mirror>

10.2、代码2

    <profile>
      <id>jdk-1.4</id>
      <activation>
        <jdk>1.4</jdk>
      </activation>
      <repositories>
        <repository>
          <id>nexus</id>
          <name>local private nexus</name>
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
              <id>nexus</id>
              <name>local private nexus</name>
              <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
              <releases>
                <enabled>true</enabled>
              </releases>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

11、打开Eclipse,设置“Preferences”

11、设置Maven选项

11.1、选择“Maven”的“User Settings”,配置在全局设置

11.2、应用保存后,Eclipse会初始化一下,很快的。这样就把Maven整合到Eclipse了。用国内镜像下载,还是很快的。

 

转载于:https://www.cnblogs.com/sdf-txt/p/7705285.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值