码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-06-08 23:50:55      阅读:500      评论:0      收藏:0      [点我收藏+]

标签:mos   form   uil   Owner   path   位置   ide   provides   settings   

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

解决办法是修改配置文件 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>

 

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

标签:mos   form   uil   Owner   path   位置   ide   provides   settings   

原文地址:http://www.cnblogs.com/song-wentao/p/6965074.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!