According to Apache Maven

Downloading in Maven is triggered by a project declaring a dependency that is not present in the local repository (or for a SNAPSHOT, when the remote repository contains one that is newer). By default, Maven will download from the central repository.

Maven central repository is located at http://repo1.maven.org/maven2/ . But when you need some libraries that do not exits in this location, it will prompt error messages in console output.

For Example,

    <dependency>
      <groupId>org.jvnet.localizer</groupId>
      <artifactId>localizer</artifactId>
      <version>1.8</version>
    </dependency>

The org.jvnet.localizer library is located at another Maven repository http://download.java.net/maven/2/, not Maven central repository. How do you tell Maven to go java.net to download the necessary dependency libraries instead of the default central repository?

What you need to do is define a so call “remote repository” in Maven’s pom.xml file, and specify the location to download the dependency library.

  <repositories>
    <repository>
      <id>java.net</id>
      <url>http://download.java.net/maven/2</url>
    </repository>
  </repositories>

Maven look-up sequence

Now, Maven’s dependency libraries look-up sequences is changed to :

1. Search in Maven local repository, if not found, continue step 2, else exit.
2. Search in Maven central repository -http://repo1.maven.org/maven2/, if not found, continue step 3, else exit.
3. Search in Maven remote repository – http://download.java.net/maven/2/, if not found, prompt error message, else exit.

This article was posted in Maven category.