User setting file does not exist C:\Users\lenevo\.m2\setting.xml 问题解决

来源:互联网 发布:编程的本质 pdf 微盘 编辑:程序博客网 时间:2024/06/05 03:07

User setting file does not exist C:\Users\lenevo\.m2\setting.xml 问题解决

(2011-01-24 11:00:14)
转载
标签: 

maven

 

.m2

 

setting.xml

 

it

分类: JAVA

当我们在myeclipse中update maven时可能会报错User setting file does not exist C:\Users\lenevo\.m2\setting.xml,以致于更新不能成功。

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

通过研究发现还可以解决令一种问题:如果我们修改maven的安装目录\conf目录下的setting.xml的repository的值,使得新的jar不在 C:\Users\lenevo\.m2中存在而在新的目录中存在,而事实上这却对maven执行时下载jar包的位置没有影响,这就是由于C:\Users\lenevo\.m2\setting.xml对maven的影响。由于C:\Users\lenevo\.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-specificsettings.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目录下。


0 0
原创粉丝点击