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

  • 相关阅读:
    flutter开发dart基本数据类型与java、kotlin、oc、swift对照表
    flutter输入框TextField设置高度以及背景色等样式的正确姿势
    flutter开发tab页面嵌套滚动的最简洁实现方式
    flutter开发自定义ExpandListView分组列表组件
    RedisUtil-redisTemplate-setNX
    数据库无限层级分类设计
    魔方
    CountDownLatch在SpringBoot中配合@Async使用
    会话刷新Token校验流程
    Mybatis 夺命十八问,顶不住了!
  • 原文地址:https://www.cnblogs.com/cool-fun/p/12462787.html
Copyright © 2020-2023  润新知