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的下载,配置环境,导入编译器,使用说明一条龙

  • 相关阅读:
    Leetcode Reverse Words in a String
    topcoder SRM 619 DIV2 GoodCompanyDivTwo
    topcoder SRM 618 DIV2 MovingRooksDiv2
    topcoder SRM 618 DIV2 WritingWords
    topcoder SRM 618 DIV2 LongWordsDiv2
    Zepto Code Rush 2014 A. Feed with Candy
    Zepto Code Rush 2014 B
    Codeforces Round #245 (Div. 2) B
    Codeforces Round #245 (Div. 2) A
    Codeforces Round #247 (Div. 2) B
  • 原文地址:https://www.cnblogs.com/cool-fun/p/12462787.html
Copyright © 2011-2022 走看看