简体   繁体   中英

Settings.xml in local maven repository

I cannot find settings.xml in my local maven repository. Please tell me where I can find it. 在此处输入图片说明

In my java class, I am getting compile time error for following.

在此处输入图片说明

I have mentioned dependency in pom.xml file also.

在此处输入图片说明

Please help me why dependency is not found even when pom.xml has dependencies.

You will find settings.xml in your maven installation directory.

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.

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

Reference: 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.

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 )

Normally we will update the one under your home/.m2/ . In your case, it should be located at C:\\Users\\yourName\\.m2\\settings.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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