1.repository
1.1 中央库
maven官方的repository。体现在 %MAVEN_HOME%/conf/setting.xml中的 <mirrors><mirror> …</mirror> </mirrors>
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>CN</id>
<name>OSChina Central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
1.2本地库
在自己机器上存储的,让maven管理的jar包的库。体现在体现在 %MAVEN_HOME%/conf/setting.xml中的<localRepository>
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
-->
<localRepository>F:/mvnRepository</localRepository>
1.3远程仓库
有的jar包不在中央库中存储------存储在另一个组织搭建的库中就需要指定远程仓库 体现在 pom.xml文件中
<project ...>
<repositories>
<repository>
<id>JBoss repository</id>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
</project>
1.4依赖机制当某jar被引用-----加入到 <dependency> ……</dependency> 中时maven会默认执行以下顺序进行依赖的添加:
在 Maven 的本地仓库搜索 xxx
在 Maven 中央存储库搜索 xxx
在 Maven 远程仓库搜索 xxx(如果在 pom.xml 中定义)
在 Maven 远程仓库搜索 xxx(如果在 pom.xml 中定义)