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.
In Maven, when you’re declared library does not exist either inlocal repository nor Maven center repository, the process will stop and output error messages to your Maven console.
1. Example
The
org.jvnet.localizer
is only available at Java.net repository.
pom.xml
org.jvnet.localizer
When you build this Maven project, it will fail and output dependency not found error message.
Updated 12/12/2012
The
The
org.jvnet.localizer
is 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 :
pom.xml
java.net
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.
No comments:
Post a Comment