[INFO] User settings file does not exist C:/Documents and Settings/zhangsb/.m2/settings.xml问题解决

偶重新安装myeclipse7.0后,重新获取代码时,出现以下错误

11-2-10 上午09时57分31秒: [INFO] User settings file does not exist C:/Documents and Settings/zhangsb/.m2/settings.xml
11-2-10 上午09时57分41秒: [INFO] User settings file does not exist C:/Documents and Settings/zhangsb/.m2/settings.xml
11-2-10 上午09时57分49秒: Unable to update index for central http://repo1.maven.org/maven2/
搜索网上文章并整理如下

 

当我们在myeclipse中update maven时可能会报错User setting file does not exist C:/Documents and Settings/zhangsb/.m2/settings.xml,以致于更新不能成功;即用svn获取新版本的源代码时,提示出现这个错误;用户名称不同,则路径中的目录会有差别。

经本人研究maven的官方说明,得到解决方案如下:将maven的安装目录/conf目录下的setting.xml拷贝到C:/Documents and Settings/zhangsb/.m2/目录下即可。

通过研究发现还可以解决令一种问题:如果我们修改maven的安装目录/conf目录下的setting.xml的repository的值,使得新的jar不在 C:/Documents and Settings/zhangsb/.m2/中存在而在新的目录中存在,而事实上这却对maven执行时下载jar包的位置没有影响,这就是由于C:/Documents and Settings/zhangsb/.m2/setting.xml对maven的影响。由于C:/Documents and Settings/zhangsb/.m2/setting.xml文件没有变化,只修改maven的安装目录/conf目录下的setting.xml也无济于事。

附maven关于这方面的说明:(url:http://maven.apache.org/settings.html

The settings element in the settings.xml file contains elements used to define values which configure Maven execution in various ways, like the pom.xml, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information.

There are two locations where a settings.xml file may live:

  • The Maven install: $M2_HOME/conf/settings.xml
  • A user's install: ${user.home}/.m2/settings.xml

The former settings.xml are also called global settings, the latter settings.xml are referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.

Tip: If you need to create user-specific settings from scratch, it's easiest to copy the global settings from your Maven installation to your ${user.home}/.m2 directory.

 

翻译如下:

 

settings.xml中的settings元素包括了用于定于值的元素,这些值配置了maven执行的多种方式,像pom.xml,但是不用哪个绑定到任何具体的项目,或者分配给一个用户。这些值包括local repository的位置,更改remoterepository 服务器,和认证的信息。
settings.xml可能存在于两个位置:
1:maven的安装路径$M2_HOME/conf/settings.xml
2: 用户安装 ${user.home}/.m2/settings.xml
前面一个settings.xml也被称为全局配置,后者settings.xml用作用户配置。如果两个文件都存在,它们的内容合并在一起,user-specific settings.xml成为主导的文件。

小贴士:如果你需要从scratch创建user-specific settings.xml,最简单的方法是从你的maven安装路径下拷贝全局配置到你的${user.home}/.m2目录下。

 

maven的含义,请参考,http://baike.baidu.com/view/336103.htm

免费的图书内容,http://www.javaeye.com/wiki/hzbook/2872-Maven-in-action

 

事后总结

此提示,我对比确实有此目录等,但与有经验的同事询问,并不影响实际使用,故没有做实际处理,虽然前一两天仍然提示,但运行正常;后来该目录下有这些对应文件,不再提示。

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值