1.Maven Local Resource Library
2.Maven Central Repository
3.Maven Remote Storage
The Dependency library query order for MAVEN changes to:
- Search in Maven local repository, if not found, enter 2nd step, otherwise exit.
- In the Maven central repository search, if not found, enter the 3rd step, otherwise exit.
- (need to be declared in Pom.xml) in Maven remote repository search, if not found, prompt for error message, otherwise exit.
- The actions are based on the Pom.xml configuration file.
①: Adding a Jar package dependency
Declaring Log4j's MAVEN coordinates into a pom.xml file, the jar package will be searched in the same manner as described above.
When Maven compiles or builds, the log4j jar is automatically downloaded and placed into the MAVEN local repository.
<dependencies> <dependency><groupid>log4j</groupid><artifactid>log4j</ Artifactid><version>1.2.14</version> </dependency></dependencies>
②: Add java.net remote Repository.
Role: Used to search for dependent jar packages, and the jar package does not exist in the local warehouse and the central repository.
<project ...> <repositories> <repository> <id>java.net</id> <url >https://maven.java.net/content/repositories/public/</url> </repository> </ Repositories> </project>
③: Add JBoss remote Repository.
Role: Used to search for dependent jar packages, and the jar package does not exist in the local warehouse and the central repository.
<project ...> <repositories> <repository><id>jboss repository</id><url >http://repository.jboss.org/nexus/content/groups/public/</url> </repository> </ Repositories></project>
Maven dependency mechanism