当前位置: 首页 > 编程日记 > 正文

使用maven镜像

综述

用maven做项目,最郁闷的莫过于某些依赖库下载不了。被墙了,你懂的。使用maven镜像仓库及其重要,特别是国内的镜像,可以有效缓解被墙疼痛。

常用的镜像

国外镜像

ibiblio.org

<mirror>  <id>ibiblio</id> <mirrorOf>central</mirrorOf> <name>ibiblio Mirror of http://repo1.maven.org/maven2/</name> <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url> </mirror> 

jboss

<mirror>  <id>jboss-public-repository-group</id> <mirrorOf>central</mirrorOf> <name>JBoss Public Repository Group</name> <url>http://repository.jboss.org/nexus/content/groups/public</url> </mirror> 

repo2

<mirror><id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> 

uk.maven.org

<mirror><id>ui</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://uk.maven.org/maven2/</url> </mirror> 

国内镜像

oschina.net

<mirror><id>nexus-osc</id> <mirrorOf>*</mirrorOf> <name>Nexus osc</name> <url>http://maven.oschina.net/content/groups/public/</url> </mirror> 

net.cn

<mirror><id>net-cn</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://maven.net.cn/content/groups/public/</url> </mirror> 

使用镜像

下文以oschina.net的镜像为例子.

1.Maven 的安装目录下的 conf 文件下有个settings.xml文件,编辑该文件

2.在<mirrors>中插入:

<mirror><id>nexus-osc</id> <mirrorOf>*</mirrorOf> <name>Nexus osc</name> <url>http://maven.oschina.net/content/groups/public/</url> </mirror> 

3.这里是配置 Maven 的 mirror 地址指向OSChina 的 Maven 镜像地址。 在执行 Maven 命令的时候, Maven 还需要安装一些插件包,这些插件包的下载地址也让其指向 oschina.net 的 Maven 地址。

<?xml version="1.0" encoding="UTF-8"?><!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--><!--| This is the configuration file for Maven. It can be specified at two levels:||  1. User Level. This settings.xml file provides configuration for a single user, |                 and is normally provided in ${user.home}/.m2/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -s /path/to/user/settings.xml||  2. Global Level. This settings.xml file provides configuration for all Maven|                 users on a machine (assuming they're all using the same Maven|                 installation). It's normally provided in |                 ${maven.home}/conf/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -gs /path/to/global/settings.xml|| The sections in this sample file are intended to give you a running start at| getting the most out of your Maven installation. Where appropriate, the default| values (values used when the setting is not specified) are provided.||-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><!-- localRepository| The path to the local repository maven will use to store artifacts.|| Default: ~/.m2/repository<localRepository>/path/to/local/repo</localRepository>--><localRepository>e:\Development\m2\repository</localRepository><!-- interactiveMode| This will determine whether maven prompts you when it needs input. If set to false,| maven will use a sensible default value, perhaps based on some other setting, for| the parameter in question.|| Default: true<interactiveMode>true</interactiveMode>--><!-- offline| Determines whether maven should attempt to connect to the network when executing a build.| This will have an effect on artifact downloads, artifact deployment, and others.|| Default: false<offline>false</offline>--><!-- pluginGroups| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.|--><pluginGroups><!-- pluginGroup| Specifies a further group identifier to use for plugin lookup.<pluginGroup>com.your.plugins</pluginGroup>--></pluginGroups><!-- proxies| This is a list of proxies which can be used on this machine to connect to the network.| Unless otherwise specified (by system property or command-line switch), the first proxy| specification in this list marked as active will be used.|--><proxies><!-- proxy| Specification for one proxy, to be used in connecting to the network.|<proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>--></proxies><!-- servers| This is a list of authentication profiles, keyed by the server-id used within the system.| Authentication profiles can be used whenever maven must make a connection to a remote server.|--><servers><!-- server| Specifies the authentication information to use when connecting to a particular server, identified by| a unique name within the system (referred to by the 'id' attribute below).| | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are |       used together.|<server><id>deploymentRepo</id><username>repouser</username><password>repopwd</password></server>--><!-- Another sample, using keys to authenticate.<server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional; leave empty if not used.</passphrase></server>--></servers><!-- mirrors| This is a list of mirrors to be used in downloading artifacts from remote repositories.| | It works like this: a POM may declare a repository to use in resolving certain artifacts.| However, this repository may have problems with heavy traffic at times, so people have mirrored| it to several places.|| That repository definition will have a unique id, so we can create a mirror reference for that| repository, to be used as an alternate download site. The mirror site will be the preferred | server for that repository.|--><mirrors><!-- mirror| Specifies a repository mirror site to use instead of a given repository. The repository that| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.|<mirror><id>mirrorId</id><mirrorOf>repositoryId</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://my.repository.com/repo/path</url></mirror>--><mirror><id>alimaven</id><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url><mirrorOf>central</mirrorOf></mirror></mirrors><!-- profiles| This is a list of profiles which can be activated in a variety of ways, and which can modify| the build process. Profiles provided in the settings.xml are intended to provide local machine-| specific paths and repository locations which allow the build to work in the local environment.|| For example, if you have an integration testing plugin - like cactus - that needs to know where| your Tomcat instance is installed, you can provide a variable here such that the variable is | dereferenced during the build process to configure the cactus plugin.|| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles| section of this document (settings.xml) - will be discussed later. Another way essentially| relies on the detection of a system property, either matching a particular value for the property,| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.| Finally, the list of active profiles can be specified directly from the command line.|| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact|       repositories, plugin repositories, and free-form properties to be used as configuration|       variables for plugins in the POM.||--><profiles><!-- profile| Specifies a set of introductions to the build process, to be activated using one or more of the| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>| or the command line, profiles have to have an ID that is unique.|| An encouraged best practice for profile identification is to use a consistent naming convention| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.| This will make it more intuitive to understand what the set of introduced profiles is attempting| to accomplish, particularly when you only have a list of profile id's for debug.|| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.<profile><id>jdk-1.4</id><activation><jdk>1.4</jdk></activation><repositories><repository><id>jdk14</id><name>Repository for JDK 1.4 builds</name><url>http://www.myhost.com/maven/jdk14</url><layout>default</layout><snapshotPolicy>always</snapshotPolicy></repository></repositories></profile>--><!--| Here is another profile, activated by the system property 'target-env' with a value of 'dev',| which provides a specific path to the Tomcat instance. To use this, your plugin configuration| might hypothetically look like:|| ...| <plugin>|   <groupId>org.myco.myplugins</groupId>|   <artifactId>myplugin</artifactId>|   |   <configuration>|     <tomcatLocation>${tomcatPath}</tomcatLocation>|   </configuration>| </plugin>| ...|| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to|       anything, you could just leave off the <value/> inside the activation-property.|<profile><id>env-dev</id><activation><property><name>target-env</name><value>dev</value></property></activation><properties><tomcatPath>/path/to/tomcat/instance</tomcatPath></properties></profile>--></profiles><!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>-->
</settings>

参考:http://maven.oschina.net/help.html

相关文章:

Jupyter Notebook 快捷键(基本)

Jupyter Notebook 快捷键 Jupyter Notebook 有两种键盘输入模式。编辑模式&#xff0c;允许你往单元中键入代码或文本&#xff1b;这时的单元框线是绿色的。命令模式&#xff0c;键盘输入运行程序命令&#xff1b;这时的单元框线是灰色。 命令模式 (按键 Esc 开启) Enter : …

关于二叉树的几个必须掌握的实现

The best way to end your fear is to face it yourself. 结束恐惧的最佳办法就是自己面对。本分分享了二叉搜索树的几种实现&#xff0c;由简入繁。说句题外话&#xff0c;马上又是金三银四的季节了&#xff0c;无论跳不跳槽&#xff0c;增加自己的知识储备总是没错的。从代码…

python数据结构与算法:队列与双端队列

双端队列&#xff1a; #################队列#################### #coding:utf-8 """ Deque() 创建一个空的双端队列 add_front(item) 从队头加入一个item元素 add_rear(item) 从队尾加入一个item元素 remove_front() 从队头删除一个item元素 remove_rear() 从…

view5.3登录桌面提示当前可用桌面资源不足

问题描述&#xff1a;用户反馈有个桌面经常提示当前可用桌面资源不足&#xff0c;开始的时候反复重启还可以使用&#xff0c;今天发现彻底无法登录了。解决方法&#xff1a;首先登录到view administrator管理平台查看该桌面发现状态是可用&#xff0c;说明桌面正常&#xff0c;…

【HDU】4706 Children's Day(模拟)

http://acm.hdu.edu.cn/showproblem.php?pid4706 该题没有输入&#xff0c;直接输出不同形状大小的N&#xff0c;在输出不同形状N的时候是要用到26个字母&#xff0c;并且是循环输出 #include <iostream>using namespace std;char map[60][60]; char a[] "abcdef…

详解原生AJAX请求demo(兼容IE5/6)

function createXHR(){ // 检测原生XHR对象是否存在if ( window.XMLHpptRequest ){// 如果存在就返回新实例return new XMLHpptRequest();} else { // 如果不存在就检测ActiveX对象// 兼容IE5/6return new ActiveXObject(Microsoft.XMLHttp);} }// 在所有的浏览器中创建XHR对象…

【POJ】3268 Silver Cow Party (将有向图的边反转)

问题链接&#xff1a;http://poj.org/problem?id3268 【问题描述】 One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1…N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectio…

项目管理深入理解08--成本管理

成本管理一章非常的重要&#xff0c;尤其是对于程序员来说&#xff0c;这方面非常的薄弱&#xff0c;但这部分知识无论是在项目管理中还是日常生活中都灰常重要&#xff0c;不然很难成为一个财务自由的程序员。此外&#xff0c;由于财务方面知识点比较多&#xff0c;特增加经济…

python数据结构与算法:双向链表

双向链表&#xff1a; ###################### P4.13-P4. 双向链表 ########################### # import singlelinkListclass Node(object):def __init__(self,item):self.elem itemself.next Noneself.prev None# class DoublelinkList(singlelinkList): #继承 class …

如何开发一个区块链应用程序

区块链是一项巧妙的发明&#xff0c;有望使数字世界更加安全和分散。通过允许数字信息的分发而不是复制&#xff0c;区块链技术创建了一种新型互联网。最初是为数字货币比特币而设计的&#xff0c;现在科技界正在寻找该技术的其他潜在用途。在不久的将来&#xff0c;我们将看到…

python数据结构与算法:栈

栈&#xff1a; Stack() 创建一个新的空栈 push(item) 添加一个新的元素item到栈顶 pop() 弹出栈顶元素 peek() 返回栈顶元素 is_empty() 判断栈是否为空 size() 返回栈的元素个数 Stack() 创建一个新的空栈 push(item) 添加一个新的元素item到栈顶 pop() 弹出栈顶元素 peek(…

【PAT (Basic Level) 】1014 福尔摩斯的约会 (20 分)

大侦探福尔摩斯接到一张奇怪的字条&#xff1a; 我们约会吧&#xff01; 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm大侦探很快就明白了&#xff0c;字条上奇怪的乱码实际上就是约会的时间星期四 14:04&#xff0c;因为前面两字符串中第 1 对相同的…

菜鸟物流云是如何帮助快递合作伙伴解决双11巨大业务负荷的?

物流云双11 双11前&#xff0c;菜鸟物流云共接入12家合作伙伴&#xff0c;全部参加双11大促活动&#xff0c;作为物流云的首次双11&#xff0c;尤其是经过了快递公司的大考经验&#xff0c;事实证明项目是靠谱的。 双11前已经整体上云的快递合作伙伴2家&#xff0c;韵达和天天&…

安装H3C的各种问题

HCL安装完成后&#xff0c;启动HCL失败&#xff1b;提示&#xff1a;“当前系统用户名中包含非ASCII字符”问题&#xff1f;HCL只能安装装在英文路径下&#xff0c;如果用户名为中文或者安装路径有中文目录&#xff0c;就会出现此问题&#xff0c;请确保系统用户名和安装路径中…

前景背景分割——ostu算法的原理及实现 OpenCV (八)

OpenCV 【八】——前景背景分割——ostu算法的原理及实现 实验结果代码实现实现原理参考资料实验结果 代码实现 #include<opencv2/opencv.hpp> #include<iostream> using namespace std; using namespace cv; //计算图像灰度直方图 Mat calcgrayhist(const Mat&am…

【PAT (Basic Level) 】1015 德才论 (25 分)

宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”&#xff1a;“是故才德全尽谓之圣人&#xff0c;才德兼亡谓之愚人&#xff0c;德胜才谓之君子&#xff0c;才胜德谓之小人。凡取人之术&#xff0c;苟不得圣人&#xff0c;君子而与之&#xff0c;与其得小人&#xff0…

浏览器启动外部软件

常可以看见使用浏览器代码启动本地应用的软件.例如qq、迅雷、等等.那么他们是怎么做到的呢? 它的奥秘:Register protocol 前言我们经常看到 tencent://..thunder://这两种开头的网址&#xff0c;往往觉得很奇怪&#xff0c;很想弄懂其中的原理&#xff0c;是如何实现的&#x…

Luogu P1082 同余方程(NOIP 2012) 题解报告

题目传送门 【题目大意】 求关于x的同余方程 ax≡1(mod b)的最小整数解。 【思路分析】 由同余方程的有关知识可得&#xff0c;ax≡1(mod b)可以化为axby1&#xff0c;此方程有解当且仅当gcd(a,b)1&#xff0c;于是就可以用欧几里得算法求出一组特解x0&#xff0c;y0。 那么x0就…

MATLAB【二】————图像做减法,批量文本处理,子图显示

clear; clc; close all;name_string ["1.5ms\100\" ];length strlength(name_string); [m,n] size(length);%%----------------------------- for num1:mstr name_string(num,1); figure(color, [1, 1, 1], position, [0, 0, 1800,800]); % 为区分边界&a…

与数据有关的问题

&#xfeff;&#xfeff;◆ 背景说明 在为用户排查问题&#xff0c;解决问题时&#xff0c;有一种情况是不容易引起大家注意的&#xff0c;那就是用户的数据&#xff1b;比如&#xff0c;数据中有某些特殊字符&#xff0c;引起展现不了或展现不正常&#xff1b;现在&#xff…

【PAT (Basic Level) 】1024 科学计数法 (20 分)

科学计数法是科学家用来表示很大或很小的数字的一种方便的方法&#xff0c;其满足正则表达式 [][1-9].[0-9]E[][0-9]&#xff0c;即数字的整数部分只有 1 位&#xff0c;小数部分至少有 1 位&#xff0c;该数字及其指数部分的正负号即使对正数也必定明确给出。 现以科学计数法…

jsp 实栗 jsp + jdbc 登录

jsp 实栗 jsp jdbc 实现登录 实现思路 一个表单页&#xff0c;输入用户登录和密码&#xff0c;然后信息提交到jsp页面进行验证&#xff0c;如果可以服务器跳转到登录成功页&#xff0c;失败&#xff0c;跳转到错误页 跳转的时候窗口的URL地址会发生变化 代码如下 编写登录代码…

OpenCV 【十】——Gamma校正 ——图像灰度变化

Gamma校正&#xff08;C、OpenCV实现&#xff09; 1.作用&#xff1a; Gamma校正是对输入图像灰度值进行的非线性操作&#xff0c;使输出图像灰度值与输入图像灰度值呈指数关系&#xff1a; 伽玛校正由以下幂律表达式定义&#xff1a; 2.函数原型 void calcHist( const Mat*…

Linux磁盘阵列技术详解(二)--raid 1创建

我在Linux磁盘阵列技术详解&#xff08;一&#xff09;里已经详细介绍了几种RAID磁盘阵列方式&#xff0c;原理以及创建raid 0 的详细步骤。那么这篇文档就着重讲解如何创建raid 1的技术&#xff1a;步骤如下&#xff1a;① 分区同样我们还是以一块硬盘的不同分区为例&#xff…

【PAT (Basic Level) 】1025 反转链表 (25 分)

给定一个常数 K 以及一个单链表 L&#xff0c;请编写程序将 L 中每 K 个结点反转。例如&#xff1a;给定 L 为 1→2→3→4→5→6&#xff0c;K 为 3&#xff0c;则输出应该为 3→2→1→6→5→4&#xff1b;如果 K 为 4&#xff0c;则输出应该为 4→3→2→1→5→6&#xff0c;即…

C#关于窗体的传值

关于窗体之间的传值我在《编程技巧与维护》杂志上写过总结文章&#xff0c;比较久远了。 开始的时候&#xff0c;用下面的方法传递&#xff0c;程序运行正常。 Form1 f1 this.Owner as Form1; //Form1 f1 (Form1)this.Owner;&#xff08;这样写也可以&#xff09; …

MATLAB【四】 ————批量适配图片信息与excel/txt等文档信息,批量移动拷贝图片,批量存图片中点和方框

1、批量读取图片&#xff0c;批量读取文件 2、适配文件与excel、txt等文档信息 3、获取显示图片ROI、Point、rect、更改像素值 4、批量移动拷贝图片&#xff0c;批量显示 5、保存显示图片或者图片中的点和方框。 clear; clc; close all;%% crop the im into 256*256 num 0…

mysql日志文件相关的配置【2】

1、二进制日志是什么&#xff1f; mysql 的二进制日志用于记录数据库上做的变更、 2、二进制日志什么时间写到磁盘 1、总的来说二进制日志会在释放锁之前就写入磁盘、也就是说在commit完成之前&#xff1b;client还没发送commit这个时候mysql并不把binlog写入磁盘、 别一方面my…

【PAT (Basic Level) 】1028 人口普查 (20 分)

某城镇进行人口普查&#xff0c;得到了全体居民的生日。现请你写个程序&#xff0c;找出镇上最年长和最年轻的人。这里确保每个输入的日期都是合法的&#xff0c;但不一定是合理的——假设已知镇上没有超过 200 岁的老人&#xff0c;而今天是 2014 年 9 月 6 日&#xff0c;所以…

SW6206超级华为快充5V5A,全协议OPPO闪充、自带电量计量、LED 灯/数码管显示

深圳市展嵘电子有限公司有需要的上帝可联系小陈&#xff1a;136-6225-3950 : 3412-1522-98SW6206 是一款高集成度的多协议双向快充移动电源专用多合一芯片&#xff0c;支持AABCL 口任意口快充。其集成了5A高效率开关充电&#xff0c;20W高效率同步升压输出&#xff0c;PPS/PD/Q…