maven仓库

 Maven 仓库的分类:pom>用户>全局
maven的仓库只有两大类:1.本地仓库 2.远程仓库,在远程仓库中又分成了3种:2.1 中央仓库 2.2 私服 2.3 其它公共库
1.1更改全局配置仓库在M2_HOME/conf/settings.xml中
    <settings>  
        <localRepository>D:\maven_new_repository</localRepository>  
    </settings>  
1.2该更用户级配置仓库
    <settings>  
        <localRepository>D:\maven_new_repository</localRepository>  
    </settings>
. 远程仓库

2.1 说到远程仓库先从 最核心的中央仓库开始,中央仓库是默认的远程仓库,maven在安装的时候,自带的就是中央仓库的配置在jar文件中定义

<repositories>  
    <repository>  
      <id>central</id>  
      <name>Central Repository</name>  
      <url>http://repo.maven.apache.org/maven2</url>  
      <layout>default</layout>  
      <snapshots>  
        <enabled>false</enabled>  
      </snapshots>  
    </repository>  
  </repositories>
3.1配置远程仓库
 <repositories>  
            <repository>  
                <id>jboss</id>  
                <name>JBoss Repository</name>  
                <url>http://repository.jboss.com/maven2/</url>  
                <releases>  
                    <updatePolicy>daily</updatePolicy><!-- never,always,interval n -->  
                    <enabled>true</enabled>  
                    <checksumPolicy>warn</checksumPolicy><!-- fail,ignore -->  
                </releases>  
                <snapshots>  
                    <enabled>false</enabled>  
                </snapshots>  
                <layout>default</layout>  
            </repository>  
</repositories>  
3.2远程仓库的认证在setting。xml中进行配置
  <servers>
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
  </servers>
 3.3部署至远程仓库在pom。xml中配置
 <distributionManagement>
<repository>
<id>deploymentRepo</id>
<name>Proficio Repository</name>
<url>url</url>
</repository>
</distributionManagement>
3.4mvn clean deploy



1.在setting.xml中的重载中央仓库的镜像
<mirror>
      <id>CN</id>
      <name>OSChina Central</name>                                                                                                                       
      <url>http://maven.oschina.net/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
2.
<mirror>
      <id>CN</id>
      <name>OSChina Central</name>                                                                                                                       
      <url>http://ipaddr/public/</url>
      <mirrorOf>*</mirrorOf>匹配所有的远程仓库,所有的都会转发到ipaddr
    </mirror>
 <mirrorOf>external:*</mirrorOf>匹配所有不在本机上的远程仓库
 <mirrorOf>rep1,rep2</mirrorOf>匹配所有rep1和rep2的仓库
 <mirrorOf>*,!rep2</mirrorOf>匹配所有仓库rep2除外
 
 
  
 

你可能感兴趣的:(maven仓库)