How can I add Maven repositories for a project. I'm using Eclipse Juno version: Juno Service Release 1 Build id: 20120920-0800 and using Fedora as my OS.
3 Answers
You can include it in your pom.xml
. Just add the repositories information inside the <project>
tag
<repositories>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
</repositories>
-
1Could you please tell me what should come exactly in ID & Name tag – sForSujit Feb 23 '17 at 06:28
-
2What is `pom.xml`? – ivanleoncz Nov 21 '17 at 13:38
-
2That's great if you're into manually editing the pom. But shouldn't there be a tab in the UI that can create/edit this section, just like the tab for Dependencies? – John Henckel Jun 21 '18 at 14:08
You have to add the repository to your settings.xml
: Maven Settings Reference. For example:
<repositories>
<repository>
<id>codehausSnapshots</id>
<name>Codehaus Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://snapshots.maven.codehaus.org/maven2</url>
<layout>default</layout>
</repository>
</repositories>
Check the settings in eclipse Window
-> Preferences
-> Maven
-> Installations
to see where this file is located.
You can also add a repository in the pom.xml
of your project to make it available for this project only.

- 38,985
- 14
- 88
- 103
-
Did that — but it did not work. And I dont't knwo why. Any hints on what could go wrong? – Martin Jan 23 '14 at 09:27
-
I had to "Select profile" for given project in eclipse, then the dependency has been downloaded - right click on project, Maven, Select Maven Profiles, select default and OK. – Jirka Meluzin Feb 07 '17 at 19:33
For new installation, follow below steps:
From the Windows “Start” button on the menu, select the “Run” menu item. Into the dialog box, enter the command “cmd” and press the “Ok” button. This will open a command window with a shell prompt.
Type cd “C:/Documents and Settings/<windows username>”/
Type mkdir .m2
Type cd .m2
Type notepad settings.xml.
This will open a new document in Notepad and show you a warning “Cannot find the settings.xml file. Do you want to create a new file?”. Select “Yes”. Enter the following code into the document:
<settings>
<localRepository>
D:/mavenrepository (Give here path of your choice)
</localRepository>
</settings>
Save the file and close out of notepad. Congrates, You are done. Happy Learning !!
from http://howtodoinjava.com/2013/01/04/how-to-change-maven-local-repository-path-in-windows/

- 594
- 1
- 10
- 27