zoukankan      html  css  js  c++  java
  • 关于maven下载速度慢,下载完的依赖包不知去向的应对措施

    前言:maven是虽然很简单好用,但是毕竟是外国的,中央仓库离你隔了一个太平洋那么远,下载依赖包就没有那么快了,网速不好可能很久都下载不完,针对于此我们可以使用阿里云的maven镜像,可以说下载速度发生了质的改变。

    进去正题:

    1.maven下载速度慢

    找到maven目录下的conf文件进入,打开setting.xml,找到mirrors标记,它里面的东西都被注释掉了,我们把里面注释删掉,可以以txt文本打开,修改为:

    <!-- mirrors 阿里云maven镜像 |-->
    <mirrors>
      <mirror>    
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
      </mirror>
    </mirrors>
    

    修改后:


    可直接在pom.xml文件加入

    <!-- pom.xml中repositories标签的作用是: 用来配置maven项目的远程仓库-->
    <repositories>
    	<repository>
    		<id>public</id>
    		<name>aliyun nexus</name>
    		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    		<releases>
    	           <enabled>true</enabled>
    		</releases>
    	</repository>
    </repositories>
    <!-- pom.xml中pluginRepository标签的作用是: 用来配置maven插件的远程仓库-->
    <pluginRepositories>
    	<pluginRepository>
    		<id>public</id>
    		<name>aliyun nexus</name>
    		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    		<releases>
    			<enabled>true</enabled>
    		</releases>
    		<snapshots>
    			<enabled>false</enabled>
    		</snapshots>
    	</pluginRepository>
    </pluginRepositories>
    

    2.maven依赖包不知去向

    此问题大多数是在配置maven的时候没有设置仓库位置,导致默认都被存放进了c盘目录下,使用IDEA可查看上篇maven的在IDEA配置中怎么样更改仓库位置。(未更改的仓库目录可能是找不到的依赖包所在位置。)

    我们可以在setting.xml文件指明仓库位置,首先创建好一个文件夹用来存放依赖包。以我的为例,我把仓库创建在E:maven.m2 epository,所以更改如下:

    <!-- pluginGroups 配置仓库路径 |-->
    <pluginGroups>E:maven.m2
    epository </pluginGroups>
    

    找到<pluginGroups>标记,修改后:

    上一篇:Maven的下载,配置环境,导入编译器,使用说明一条龙

  • 相关阅读:
    函数中this指向问题及函数不同方式的调用
    拷贝继承
    组合继承
    借用构造函数
    继承
    UVA-11054(扫描法)
    hihocoder-1347 小h的树上的朋友(lca+线段树)
    UVA-10391(字符串检索)
    UVA-10125(中途相遇法)
    UVA-10827(前缀和降维)
  • 原文地址:https://www.cnblogs.com/cool-fun/p/12462787.html
Copyright © 2011-2022 走看看