简体   繁体   English

本地Maven存储库中的Settings.xml

[英]Settings.xml in local maven repository

I cannot find settings.xml in my local maven repository. 我在本地Maven存储库中找不到settings.xml。 Please tell me where I can find it. 请告诉我在哪里可以找到它。 在此处输入图片说明

In my java class, I am getting compile time error for following. 在我的java类中,出现以下编译时错误。

在此处输入图片说明

I have mentioned dependency in pom.xml file also. 我也提到了pom.xml文件中的依赖项。

在此处输入图片说明

Please help me why dependency is not found even when pom.xml has dependencies. 请帮助我,即使pom.xml具有依赖项,为什么也找不到依赖项。

You will find settings.xml in your maven installation directory. 您将在maven安装目录中找到settings.xml。

eg, If you have unzipped your maven inside C:\\apache-maven-3.0.4 directory then the settings.xml will be present in: C:\\apache-maven-3.0.4\\conf directory. 例如,如果您已将Maven解压缩到C:\\ apache-maven-3.0.4目录中,则settings.xml将出现在:C:\\ apache-maven-3.0.4 \\ conf目录中。

There are two locations where a settings.xml file may live: settings.xml文件可能存在两个位置:

  • The Maven install: $M2_HOME/conf/settings.xml Maven安装:$ M2_HOME / conf / settings.xml
  • A user's install: ${user.home}/.m2/settings.xml 用户的安装:$ {user.home} /。m2 / settings.xml

Reference: http://maven.apache.org/ref/3.1.1/maven-settings/settings.html 参考: http : //maven.apache.org/ref/3.1.1/maven-settings/settings.html

Eg (depends on your operating system) 例如(取决于您的操作系统)

%userprofile%\.m2\settings.xml
C:\Users\<YourName>\.m2\settings.xml
C:\Documents and Settings\<YourName>\.m2\settings.xml
~/.m2/settings.xml
/home/<YourName>/.m2/settings.xml

or 要么

<MAVEN_INSTALL_DIR>/conf/settings.xml

settings.xml is NOT located in repository directory. settings.xml 不在存储库目录中。

There are two settings.xml files that Maven will lookup automatically, one is in the Maven installation directory, and one is in your home/.m2/ (not your home/.m2/repository ) Maven将自动查找两个settings.xml文件,一个在Maven安装目录中,一个在your home/.m2/ (而不是your home/.m2/repository )中。

Normally we will update the one under your home/.m2/ . 通常,我们会在your home/.m2/下更新一个。 In your case, it should be located at C:\\Users\\yourName\\.m2\\settings.xml 就您而言,它应该位于C:\\Users\\yourName\\.m2\\settings.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM