Maven remote warehouse jar package download

In Maven, what should I do when the jar package you declare does not exist in the local repository and does not exist in the Maven central repository?

1. Example

 org.jvnet.localizer only works with  Java.net repositories

pom.xml

 

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

 

When you build this Maven project, it will fail to find dependencies and output an error message.

2. Declare the Java.net repository

To tell Maven to get Java.net dependencies, you need to declare the remote repository in the pom.xml file like this:

pom.xml

<repositories>
	<repository>
	    <id>java.net</id>
	    <url>https://maven.java.net/content/repositories/public/</url>
	</repository>
    </repositories>

With this setup, the Maven dependency library query becomes the following sequence:

  1. Search in the Maven local repository, no, go to step 2, otherwise exit.
  2. Search in Maven Central Repository, none, go to step 3, otherwise exit.
  3. Search in java.net Maven's remote repository, none, prompt an error message, otherwise exit.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325520918&siteId=291194637