Maven更新慢怎么办?试试换成国内镜像

汗一个,最近刚找到方法。以前竟然忍受那么慢的更新速度。

解决办法是修改配置文件 apache-maven-3.3.3\conf\settings.xml

我这边主要做了三个地方的修改

1、仓库保存位置(默认是C盘),修改如下图

2、添加镜像站点。找到 mirrors标签。修改如下图:

3、修改默认JDK版本

完整的文档settings.xml如下:

  1 <?xml version="1.0" encoding="UTF-8"?>
  2
  3 <!--
  4 Licensed to the Apache Software Foundation (ASF) under one
  5 or more contributor license agreements.  See the NOTICE file
  6 distributed with this work for additional information
  7 regarding copyright ownership.  The ASF licenses this file
  8 to you under the Apache License, Version 2.0 (the
  9 "License"); you may not use this file except in compliance
 10 with the License.  You may obtain a copy of the License at
 11
 12     http://www.apache.org/licenses/LICENSE-2.0
 13
 14 Unless required by applicable law or agreed to in writing,
 15 software distributed under the License is distributed on an
 16 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17 KIND, either express or implied.  See the License for the
 18 specific language governing permissions and limitations
 19 under the License.
 20 -->
 21
 22 <!--
 23  | This is the configuration file for Maven. It can be specified at two levels:
 24  |
 25  |  1. User Level. This settings.xml file provides configuration for a single user,
 26  |                 and is normally provided in ${user.home}/.m2/settings.xml.
 27  |
 28  |                 NOTE: This location can be overridden with the CLI option:
 29  |
 30  |                 -s /path/to/user/settings.xml
 31  |
 32  |  2. Global Level. This settings.xml file provides configuration for all Maven
 33  |                 users on a machine (assuming they‘re all using the same Maven
 34  |                 installation). It‘s normally provided in
 35  |                 ${maven.home}/conf/settings.xml.
 36  |
 37  |                 NOTE: This location can be overridden with the CLI option:
 38  |
 39  |                 -gs /path/to/global/settings.xml
 40  |
 41  | The sections in this sample file are intended to give you a running start at
 42  | getting the most out of your Maven installation. Where appropriate, the default
 43  | values (values used when the setting is not specified) are provided.
 44  |
 45  |-->
 46 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
 47           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 48           xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 49   <!-- localRepository
 50    | The path to the local repository maven will use to store artifacts.
 51    |
 52    | Default: ${user.home}/.m2/repository
 53   -->
 54   <localRepository>D:\libdev\apache-maven-3.3.3\repository</localRepository>
 55
 56   <!-- interactiveMode
 57    | This will determine whether maven prompts you when it needs input. If set to false,
 58    | maven will use a sensible default value, perhaps based on some other setting, for
 59    | the parameter in question.
 60    |
 61    | Default: true
 62   <interactiveMode>true</interactiveMode>
 63   -->
 64
 65   <!-- offline
 66    | Determines whether maven should attempt to connect to the network when executing a build.
 67    | This will have an effect on artifact downloads, artifact deployment, and others.
 68    |
 69    | Default: false
 70   <offline>false</offline>
 71   -->
 72
 73   <!-- pluginGroups
 74    | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
 75    | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
 76    | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
 77    |-->
 78   <pluginGroups>
 79     <!-- pluginGroup
 80      | Specifies a further group identifier to use for plugin lookup.
 81     <pluginGroup>com.your.plugins</pluginGroup>
 82     -->
 83   </pluginGroups>
 84
 85   <!-- proxies
 86    | This is a list of proxies which can be used on this machine to connect to the network.
 87    | Unless otherwise specified (by system property or command-line switch), the first proxy
 88    | specification in this list marked as active will be used.
 89    |-->
 90   <proxies>
 91     <!-- proxy
 92      | Specification for one proxy, to be used in connecting to the network.
 93      |
 94     <proxy>
 95       <id>optional</id>
 96       <active>true</active>
 97       <protocol>http</protocol>
 98       <username>proxyuser</username>
 99       <password>proxypass</password>
100       <host>proxy.host.net</host>
101       <port>80</port>
102       <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
103     </proxy>
104     -->
105   </proxies>
106
107   <!-- servers
108    | This is a list of authentication profiles, keyed by the server-id used within the system.
109    | Authentication profiles can be used whenever maven must make a connection to a remote server.
110    |-->
111   <servers>
112   </servers>
113   <mirrors>
114     <mirror>
115         <id>nexus-aliyun</id>
116         <mirrorOf>*</mirrorOf>
117         <name>Nexus aliyun</name>
118         <url>http://maven.aliyun.com/nexus/content/groups/public</url>
119     </mirror>
120   </mirrors>
121   <profiles>
122     <profile>
123         <id>jdk-1.8</id>
124         <activation>
125             <activeByDefault>true</activeByDefault>
126             <jdk>1.8</jdk>
127         </activation>
128         <properties>
129             <maven.compiler.source>1.8</maven.compiler.source>
130             <maven.compiler.target>1.8</maven.compiler.target>
131             <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
132         </properties>
133     </profile>
134   </profiles>
135 </settings>
时间: 2024-10-12 17:29:16

Maven更新慢怎么办?试试换成国内镜像的相关文章

composer修改成国内镜像

因为composer安装包数据是从github.com上下载的,安装包的元数据从packagist.org上下载 作为两个国外的网站,连接速度会很慢,而且很有可能网站被墙. 所以composer中国全量镜像将安装包数据以及安装包元数据缓存到国内的机房,并通过国内的CDN进行加速, 这样我们访问时就不用向国外的网站发起请求,所以提升了访问的速度. 配置: 那么我们怎么使用composer中国全量镜像呢? 首先可以查看一下当前的地址: $ composer config -g repo.packag

pip使用国内镜像

使用国内镜像通过pip安装python 包 pip安装python包时超时或是报错"Cannot fetch index base URL http://e.pypi.python.org/simple/" 解决方法:加上参数"-i http://pypi.v2ex.com/simple",即换成国内镜像. 一劳永逸的办法:~/.pip/ 下创建文件 pip.conf(如果还没有的话),并填入以下内容: [global] timeout = 6000 index-u

Maven的国内镜像(解决jar下载过慢)

Maven简介 maven作为一个项目管理工具确实非常好用,结果在使用时候,你会发现下载jar速度不如自己在网上下载.之前oschina的中央仓库可用,现在oschina的maven服务器关了,只能拿国内镜像来替代.在网上发现阿里云公开了一个中央仓库,就顺手写下来了,方便以后使用. 修改Maven目录中的conf/settings.xml 找到mirrors节点,添加到节点下 1.这是阿里云仓库 <mirror> <id>alimaven</id> <name&g

让PIP源使用国内镜像,提升下载速度和安装成功率。

对于Python开发用户来讲,PIP安装软件包是家常便饭.但国外的源下载速度实在太慢,浪费时间.而且经常出现下载后安装出错问题.所以把PIP安装源替换成国内镜像,可以大幅提升下载速度,还可以提高安装成功率. 国内源: 新版ubuntu要求使用https源,要注意. 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.us

eclipse使用国内镜像站点安装插件

把eclipse 4.x的界面改为经典样式 打开eclipse,菜单栏>windows>preference>general>appearance>theme>classic>ok,如下图: 然后重启eclipse.如下图: 打开eclipse,菜单栏>help>install new software>available software sites,如下图 根据默认的官方网址改成国内镜像源,例如: 可以据此添加国内的eclipse源,把 ht

让pip使用国内镜像,解决下载速度慢的问题

对于Python开发用户来讲,PIP安装软件包是家常便饭.但国外的源下载速度实在太慢,浪费时间.而且经常出现下载后安装出错问题.所以把PIP安装源替换成国内镜像,可以大幅提升下载速度,还可以提高安装成功率. 国内源: 新版ubuntu要求使用https源,要注意. 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.us

pip国内镜像,提升下载速度和安装成功率

对于Python开发用户来讲,PIP安装软件包是家常便饭.但国外的源下载速度实在太慢,浪费时间.而且经常出现下载后安装出错问题.所以把PIP安装源替换成国内镜像,可以大幅提升下载速度,还可以提高安装成功率. 国内源: 新版ubuntu要求使用https源,要注意. 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.us

转:让PIP源使用国内镜像,提升下载速度和安装成功率。

对于Python开发用户来讲,PIP安装软件包是家常便饭.但国外的源下载速度实在太慢,浪费时间.而且经常出现下载后安装出错问题.所以把PIP安装源替换成国内镜像,可以大幅提升下载速度,还可以提高安装成功率. 国内源: 新版ubuntu要求使用https源,要注意. 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.us

PIP源使用国内镜像

让PIP源使用国内镜像,提升下载速度和安装成功率. 对于Python开发用户来讲,PIP安装软件包是家常便饭.但国外的源下载速度实在太慢,浪费时间.而且经常出现下载后安装出错问题.所以把PIP安装源替换成国内镜像,可以大幅提升下载速度,还可以提高安装成功率. 国内源: 新版ubuntu要求使用https源,要注意. 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技