当前位置:编程学习 > 网站相关 >>

Maven之settings私库配置

print?<?xml version="1.0" encoding="UTF-8"?> 
 
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"  
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
  <!--设置本地仓库--> 
  <localRepository>F:/.m2/repository</localRepository> 
   
  <pluginGroups> 
  </pluginGroups> 
 
  <proxies> 
  </proxies> 
 
  <!--设置私库认证信息--> 
  <servers> 
  <server> 
    <id>nexus-releases</id> 
    <username>admin</username> 
    <password>admin123</password> 
  </server> 
  <server> 
    <id>nexus-snapshots</id> 
    <username>admin</username> 
    <password>admin123</password> 
  </server> 
  </servers> 
   
  <!--设置私库mirror 表示maven所有的请求都由nexus来处理--> 
  <mirrors> 
    <mirror> 
        <id>nexus</id> 
        <mirrorOf>*</mirrorOf> 
        <name>Nexus Mirror.</name> 
        <url>http://localhost:8081/nexus/content/groups/public</url> 
    </mirror> 
  </mirrors> 
 
  <!--设置maven私库信息--> 
  <profiles>   
    <profile> 
        <id>nexus</id> 
        <repositories> 
          <repository> 
            <id>nexus</id> 
            <name>Nexus</name> 
            <url>http://localhost:8081/nexus/content/groups/public/</url> 
            <releases><enabled>true</enabled></releases> 
            <snapshots><enabled>true</enabled></snapshots> 
          </repository> 
        </repositories> 
        <pluginRepositories> 
          <pluginRepository> 
            <id>nexus</id> 
            <name>Nexus</name> 
            <url>http://localhost:8081/nexus/content/groups/public/</url> 
            <releases><enabled>true</enabled></releases> 
            <snapshots><enabled>true</enabled></snapshots> 
          </pluginRepository> 
        </pluginRepositories> 
    </profile> 
    <!--覆盖maven中央仓库设置开启releases和snapshots版本的下载--> 
    <profile> 
        <id>central</id> 
        <repositories> 
             <repository> 
                <id>central</id> 
                <url>http://central</url> 
                <releases><enabled>true</enabled></releases> 
                <snapshots><enabled>true</enabled></snapshots> 
            </repository> 
        </repositories> 
        <pluginRepositories> 
            <pluginRepository> 
                <id>central</id> 
                <url>http://central</url> 
                <releases><enabled>true</enabled></releases> 
                <snapshots><enabled>true</enabled></snapshots> 
            </pluginRepository> 
        </pluginRepositories> 
    </profile> 
  </profiles> 
 
  <!--激活私库信息的配置--> 
    <activeProfiles> 
        <activeProfile>nexus</activeProfile> 
        <activeProfile>central</activeProfile> 
    </activeProfiles> 
</settings> 
 
 
在项目的pom文件中做如下设置 
<!-- nexus-releases nexus-snapshots与settings.xml中server下的id对应 --> 
<distributionManagement> 
    <repository> 
        <id>nexus-releases</id> 
        <name>Nexus Releases Repository</name> 
        <url>http://localhost:8081/nexus/content/repositories/releases/</url> 
    </repository> 
    <snapshotRepository> 
        <id>nexus-snapshots</id> 
     &

补充:综合编程 , 其他综合 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,