Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Maven repositories for a project in Eclipse?

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.

like image 904
Savio Mathew Avatar asked Mar 15 '13 09:03

Savio Mathew


People also ask

How do I add Maven dependencies to an existing project in Eclipse?

Via the Maven index, you can search for dependencies, select them and add them to your pom file. To download the index, select Windows > Preferences > Maven and enable the Download repository index updates on startup option. After changing this setting, restart Eclipse. This triggers the download of the Maven index.


2 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>
like image 55
greenkode Avatar answered Sep 21 '22 18:09

greenkode


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.

like image 20
Kai Avatar answered Sep 24 '22 18:09

Kai