Maven相关名词、概念-解释总结

来源:互联网 发布:红米note3怎么内存优化 编辑:程序博客网 时间:2024/05/17 03:59

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 中定义)
原创粉丝点击