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

Maven国内源设置 - OSChina国内源失效了,别更新了

Maven国内源设置 - OSChina国内源失效了,别更新了

原文:http://blog.csdn.net/chwshuang/article/details/52198932

        最近在写一个Spring4.x + SpringMVC+Mybatis零配置的文章,使用的源配的是公司的私有仓库,但是为了让其他人能够通过下载代码在自己本机上运行,所以我就改成OSChina的源,现在网上一大把的文章,说这个源好用,比较方便,结果更新源之后,一直是等待的状态,我还以为我配错了,各种谷歌(没听错,就是google,我们公司能用)、百度查问题,结果还是不行。然后我就把源地址通过浏览器打开,结果打不开,我又试着将jboss和maven官方的源地址放到浏览器打开,发现是能正常打开的。后来在网上找原因,发现OSChina的源关闭了,但是也有它们官方的文章说跟天翼云合作,又可以打开了,结果还是打不开!都是坑啊!鉴于OSChina中国Maven源的不稳定性和不友好性,我决定写这个文章提醒大家,别用OSChina的Maven中国源了,还是用官方的吧!如果你配置了OSChina的Maven中国源,结果出现问题,赶紧换回来,下面我来告诉你这么做:

1. 配置maven项目的setting.xml文件

        不管你用哪个IDE,eclipse还是Idea,首先你要修改maven对应的setting.xml文件,主要是在这个文件的<mirrors>标签中加入正常的源地址,而且一定记住,你要将<url>标签的地址用浏览器打开一下,看看是否能访问。如果不能访问,就不要配置了。下面是我setting.xml文件里<mirrors>标签配置:

<mirrors>标签的意思是镜像仓库,可以配多个。由于国内的不靠谱和不稳定,还是原装的好!

[html] view plain copy
  1. <mirrors>  
  2. <mirror>  
  3. <id>alimaven</id>  
  4. <mirrorOf>central</mirrorOf>  
  5. <name>aliyun maven</name>  
  6. <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
  7. </mirror>  
  8. <mirror>  
  9. <id>ui</id>  
  10. <mirrorOf>central</mirrorOf>  
  11. <name>Human Readable Name for this Mirror.</name>  
  12. <url>http://uk.maven.org/maven2/</url>  
  13. </mirror>  
  14. <mirror>  
  15. <id>jboss-public-repository-group</id>  
  16. <mirrorOf>central</mirrorOf>  
  17. <name>JBoss Public Repository Group</name>  
  18. <url>http://repository.jboss.org/nexus/content/groups/public</url>  
  19. </mirror>  
  20. </mirrors>  

     

 

  当然,你最好是配置一下本地仓库,如果你已经配置了,就不用管了。目的就是统一,以免maven默认本地仓库与IDE工具配置的不一致。

[html] view plain copy
  1. <localRepository>/Users/admin/.m2/repository</localRepository>  


        然后在你是项目pom.xml文件中配置仓库地址:

[html] view plain copy
  1. <!-- repositories节点是配置maven下载jar的中央仓库,
  2. 默认的是国外的,下载奇慢无比,推荐使用自己搭建sonatype nexus中央仓库 -->  
  3. <repositories>  
  4. <repository>  
  5. <id>central</id>  
  6. <name>Central Repository</name>  
  7. <url>http://repo1.maven.org/maven2/</url>  
  8. <snapshots>  
  9. <enabled>false</enabled>  
  10. </snapshots>  
  11. </repository>  
  12. <repository>  
  13. <id>jboss-public-repository-group</id>  
  14. <name>JBoss Public Repository Group</name>  
  15. <url>http://repository.jboss.org/nexus/content/groups/public/</url>  
  16. <layout>default</layout>  
  17. <releases>  
  18. <enabled>true</enabled>  
  19. <updatePolicy>never</updatePolicy>  
  20. </releases>  
  21. <snapshots>  
  22. <enabled>true</enabled>  
  23. <updatePolicy>never</updatePolicy>  
  24. </snapshots>  
  25. </repository>  
  26. <repository>  
  27. <id>jboss-deprecated</id>  
  28. <name>JBoss Deprecated</name>  
  29. <url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>  
  30. <layout>default</layout>  
  31. <releases>  
  32. <enabled>true</enabled>  
  33. <updatePolicy>never</updatePolicy>  
  34. </releases>  
  35. <snapshots>  
  36. <enabled>false</enabled>  
  37. </snapshots>  
  38. </repository>  
  39. <repository>  
  40. <id>jboss-maven2-brew</id>  
  41. <name>JBoss Maven 2 Brew Repository</name>  
  42. <url>http://repository.jboss.org/maven2-brew/</url>  
  43. <layout>default</layout>  
  44. <releases>  
  45. <enabled>true</enabled>  
  46. <updatePolicy>never</updatePolicy>  
  47. </releases>  
  48. <snapshots>  
  49. <enabled>false</enabled>  
  50. </snapshots>  
  51. </repository>  
  52. <repository>  
  53. <id>io.spring.repo.maven.release</id>  
  54. <url>http://repo.spring.io/release/</url>  
  55. <snapshots>  
  56. <enabled>false</enabled>  
  57. </snapshots>  
  58. </repository>  
  59. <repository>  
  60. <id>io.spring.repo.maven.milestone</id>  
  61. <url>http://repo.spring.io/milestone/</url>  
  62. <snapshots>  
  63. <enabled>false</enabled>  
  64. </snapshots>  
  65. </repository>  
  66. </repositories>  


如果你按照第一步配置了阿里云的maven地址,那么就不用配置上面的<repository>标签内容了,因为目前来看,阿里云的maven地址是最合适的。 

转载于:https://www.cnblogs.com/gyadmin/p/8266833.html

相关文章:

如何使用Next.js创建动态的Rick and Morty Wiki Web App

Building web apps with dynamic APIs and server side rendering are a way to give people a great experience both with content and speed. How can we use Next.js to easily build those apps?使用动态API和服务器端渲染来构建Web应用程序是一种使人们在内容和速度上都…

安装部署Spark 1.x Standalone模式集群

Configuration spark-env.sh HADOOP_CONF_DIR/opt/data02/hadoop-2.6.0-cdh5.4.0/etc/hadoop JAVA_HOME/opt/modules/jdk1.7.0_67 SCALA_HOME/opt/modules/scala-2.10.4 ####################################################### #主节点 …

算法(3)简单四则运算

1.0 问题描述 实现10以内四则运算&#xff08;只包含数字&#xff0c;*/和小括号&#xff09; 2.0 问题分析 四则运算使用“后缀表达式”算法来计算&#xff0c;后缀表达式可以无需考虑运算符优先级&#xff0c;直接从左至右依次计算。问题分解成2部分&#xff0c;一是将“中…

调用短信接口,先var_dump()看数据类型是object需要json_decode(json_encode( $resp),true)转换成array...

返回的数据.先看类型,如果是object类型 先json_encode, 再json_decode,加true 转换成数组 $resp $c->execute($req); var_dump($resp); object(stdClass)#12 (2) { ["result"]> object(stdClass)#13 (3) { ["err_code"]> string(1) "0"…

nlp文本数据增强_如何使用Texthero为您的NLP项目准备基于文本的数据集

nlp文本数据增强Natural Language Processing (NLP) is one of the most important fields of study and research in today’s world. It has many applications in the business sector such as chatbots, sentiment analysis, and document classification.Preprocessing an…

R语言-基础解析

二、操作基础%%取余%/%整数除法(1)eigen(...)求解方阵的特征值和特征向量(2)solve(D,A)求解DXA(3)data<-list(...)取里面的对象data[["列名称"]]&#xff1b;data[[下标]]&#xff1b;data$列名称(4)unlist(列表对象)把列表对象转化为向量对象(5)names(数据框)读取…

算法(4)数据结构:堆

1.0 问题描述 实现数据结构&#xff1a;堆。 2.0 问题分析 堆一般使用数组来表示&#xff0c;其中某个节点下标i的两个子节点的下标为 2i1 和 2i2。堆是一棵完全二叉树。堆有3种基本操作&#xff1a;创建&#xff0c;插入&#xff0c;删除。这3种操作都需要通过“调整堆”的…

cookie 和session 的区别详解

转自 https://www.cnblogs.com/shiyangxt/archive/2008/10/07/1305506.html 这些都是基础知识&#xff0c;不过有必要做深入了解。先简单介绍一下。 二者的定义&#xff1a; 当你在浏览网站的时候&#xff0c;WEB 服务器会先送一小小资料放在你的计算机上&#xff0c;Cookie 会…

如何设置Java Spring Boot JWT授权和认证

In the past month, I had a chance to implement JWT auth for a side project. I have previously worked with JWT in Ruby on Rails, but this was my first time in Spring. 在过去的一个月中&#xff0c;我有机会为辅助项目实现JWT auth。 我以前曾在Ruby on Rails中使用…

算法(5)哈希表

1.0 问题描述 实现数据结构&#xff1a;哈希表。 2.0 问题分析 哈希表可以看作我们经常使用的字典&#xff08;swift&#xff09;或对象&#xff08;js&#xff09;&#xff0c;可以让一个key&value对一一对应&#xff0c;可以快速根据key找到value。哈希表内部使用数组…

《面向对象程序设计》c++第五次作业___calculator plus plus

c第五次作业 Calculator plusplus 代码传送门 PS:这次作业仍然orz感谢一位同学与一位学长的windows帮助&#xff0c;同时再次吐槽作业对Mac系统用户的不友好。&#xff08;没朋友千万别用Mac&#xff01;&#xff01;&#xff01;&#xff09; 还有想吐槽作业对规范的要求大大超…

联合体union和大小端(big-endian、little-endian)

1.联合体union的基本特性——和struct的同与不同union&#xff0c;中文名“联合体、共用体”&#xff0c;在某种程度上类似结构体struct的一种数据结构&#xff0c;共用体(union)和结构体(struct)同样可以包含很多种数据类型和变量。在成员完全相同的情况下&#xff0c;struct比…

前端面试的作品示例_如何回答任何技术面试问题-包括示例

前端面试的作品示例Technical interviews can be extremely daunting. From the beginning of each question to the end, its important to know what to expect, and to be aware of the areas you might be asked about. 技术面试可能会非常艰巨。 从每个问题的开始到结束&a…

$(shell expr $(MAKE_VERSION) \= 3.81) 这里“\”的解释

android/build/core/main.mk $(shell expr $(MAKE_VERSION) \> 3.81) 为什么要加多一个“\”,因为">"会被shell解析为重定向符号&#xff0c;所以需要转义或用引号包围 所以&#xff0c;也可以这样写$(shell expr $(MAKE_VERSION) “>” 3.81)转载于:https:…

iOS应用模块化的思考及落地方案(一)模块的划分及模块化工作流程

1.0 什么是模块化 很多关于重构及设计模式的介绍中&#xff0c;经常提到的几个词语是复用及解耦。 模块化之所以被提出&#xff0c;也更多是为了解决这几个问题。 复用可以减少重复造轮子的情况&#xff0c;很容易理解的是&#xff0c;我们经常使用的github上的第三方框架&a…

Swiper 用法

部分常用API ininialSlide: 2, //起始图片切换的索引位置&#xff08;起始从0开始&#xff0c;默认为0&#xff09; autoplay: 3000, //设置自动切换时间&#xff0c;单位毫秒 speed: 1000, //设置滑动速度 continuous: true, //无限循环的图片切换效果 disableScroll: true, /…

node/js 漏洞_6个可用于检查Node.js中漏洞的工具

node/js 漏洞Vulnerabilities can exist in all products. The larger your software grows, the greater the potential for vulnerabilities. 所有产品中都可能存在漏洞。 您的软件增长得越大&#xff0c;潜在的漏洞就越大。 Vulnerabilities create opportunities for expl…

发现一个浏览器很奇怪的问题

浏览器有8个请求状态为pending时&#xff0c;在另一个tab中&#xff0c;请求就发布出去了&#xff0c;一直是stalled。直到pending状态变成了cancled状态。 试了360浏览器&#xff08;谷歌内核&#xff09;和chrome浏览器&#xff0c;都是这样。 具体的原因待深究 参考&#xf…

wamp配置虚拟主机

因为wampserver的php版本一直是5.x版本&#xff1b;因此转投xmapp用了一段时间&#xff1b; 意外发现wampserver3更新了&#xff1b;php也终于更新到7了&#xff1b; 果断还是决定回到wampserver的怀抱&#xff1b; 然后有意外的发现了wampserver3有了新功能&#xff1b;可以方…

iOS应用模块化的思考及落地方案(二)模块化自动构建工具的使用

1.0 iOS模块化中的问题 前文已经介绍了模块化的流程及一些常见的问题&#xff0c;我们在这里再次总结一下。 在工作中&#xff0c;当我们开始一个新项目的时候&#xff0c;最先考虑的就是模块化工作。 模块化工作的想法是很美好的&#xff0c;可是执行过程中会遇到很多的问题…

aws fargate_我如何在AWS Fargate上部署#100DaysOfCloud Twitter Bot

aws fargateAfter passing my last certification, I asked myself how much time I spent studying cloud computing.通过上一份认证后&#xff0c;我问自己自己花了多少时间研究云计算。 More than 100 days!超过100天&#xff01; It also made me realize two things:这也…

think in Java 第五章之垃圾回收类型

1.引用计数&#xff1a; 每个对象都含有一个引用计数器&#xff0c;当有引用连接至对象时&#xff0c;引用计数加1&#xff0c;当引用离开作用域或被置为null时&#xff0c;引用计数减1. 缺陷&#xff1a;在对象循环引用时&#xff0c;存在“对象应该被回收&#xff0c;引用计数…

Yii 错误页面处理

【错误页面处理】 訪问一个错误的控制器 訪问一个错误的方法 有些控制器和方法禁止訪问 以上訪问会提示错误信息 404 403 以上错误信息是不方便给外边用户看到的。 1. 安全隐患 2. 用户体验不好 错误信息在site/error这个地方定义的。如今我们要自己定义错误页面来显示我们的错…

设置RGBColor

#define kUIColorFromRGB(rgbValue) [UIColor \colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

自学成才翁_作为一名自学成才的开发者从“我的旅程”中吸取的教训

自学成才翁The path of the self-taught developer is tough and filled with uncertainty. There is no straight line from newbie to career programmer. Because of this, I believe all self-taught developers have a unique story to tell.自学成才的开发者之路艰难而充…

67)vector的begin() end() 和 front() back()的区别 rbegin() rend()

1&#xff09; 2&#xff09;v1.begin() 和v1.end&#xff08;&#xff09; 是作为迭代器v1的 第一个位置 和 最后一个元素的下一个位置。 v1.front() 是v1这个动态数组的第一个元素的值 v1.back()是v1的最后一个元素的值。 3&#xff09; 4&#xff09;正向和反向的使…

倒置函数reverse的用法

倒置字符串函数reverse&#xff1a;用于倒置字符串s中的各个字符的位置&#xff0c;如原来字符串中如果初始值为123456&#xff0c;则通过reverse函数可将其倒置为654321&#xff0c;程序如下&#xff1a;#include<stdio.h>#include<string.h>void reverse(char s[…

设置tabbaritem的title的颜色及按钮图片

设置title颜色&#xff1a; [[UITabBarItem appearance] setTitleTextAttributes:{NSForegroundColorAttributeName : kUIColorFromRGB(0xb2151c)} forState:UIControlStateSelected]; 设置按钮图片&#xff1a; UIImage *commonImage [UIImage imageNamed:[NSString strin…

helm部署仓库中没有的包_Kubernetes的Helm软件包管理器简介

helm部署仓库中没有的包Before we dive into the Helm package manager, Im going to explain some key concepts to deploying any application anywhere. Ill also give you a brief introduction to Kubernetes terminology.在深入研究Helm软件包管理器之前 &#xff0c;我将…

mem 族函数的实现

1.void * memcpy ( void * dest, const void * src, size_t num ); 头文件&#xff1a;#include <string.h>memcpy() 用来复制内存&#xff0c;memcpy() 会复制 src 所指的内存内容的前 num 个字节到 dest 所指的内存地址上。memcpy() 并不关心被复制的数据类型&#xff…