How to download from Maven remote repository?
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.
org.jvnet.localizer is only available at Java.net repository.
<dependency> <groupId>org.jvnet.localizer</groupId> <artifactId>localizer</artifactId> <version>1.8</version> </dependency>
When you build this Maven project, it will fail and output dependency not found error message.
org.jvnet.localizeris now available in Maven center repository.
2. Declare Java.net repository
To tell Maven to get the dependency from Java.net, you need to declared a
remote repository in your
pom.xml file like this :
<repositories> <repository> <id>java.net</id> <url>https://maven.java.net/content/repositories/public/</url> </repository> </repositories>
Now, Maven’s dependency library look-up sequences is changed to :
- Search in Maven local repository, if not found, go step 2, else exit.
- Search in Maven central repository, if not found, go step 3, else exit.
- Search in java.net Maven remote repository, if not found, prompt error message, else exit.