美文网首页
nexus maven私服搭建

nexus maven私服搭建

作者: 往后余生9375 | 来源:发表于2021-11-03 20:38 被阅读0次

    Maven用到的Repositories说明
    maven-central:maven中央库,默认从https://repo1.maven.org/maven2/拉取jar
    maven-releases:私库发行版jar
    maven-snapshots:私库快照(调试版本)jar(只需要在发布的版本号后面加上-SNAPSHOT
    maven-public:仓库分组,把上面三个仓库组合在一起对外提供服务,在本地maven基础配置settings.xml中使用。

    nexus3中央仓库改为阿里云


    image.png
    image.png

    https://maven.aliyun.com/repository/central

    配置文件

    <?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">
    
      <pluginGroups>
      </pluginGroups>
    
      <proxies>
     
      </proxies>
    
     
      <servers>
       <server>  
             <id>nexus-releases</id>  
             <username>admin</username>  
             <password>h*yi</password>  
         </server>  
         <server>  
             <id>nexus-snapshots</id>  
             <username>admin</username>  
             <password>h*yi</password>  
         </server> 
        <server>  
             <id>central</id>  
             <username>admin</username>  
             <password>h*yi</password>  
         </server>   
      </servers>
    
     
      <mirrors>
         <mirror>  
              <id>central</id>  
              <mirrorOf>*</mirrorOf>  
              <name>Central Repository</name>  
              <url>http://139.155.180.*:8081/repository/maven-public/</url>  
          </mirror> 
      </mirrors>
    
      
      <profiles>
        <profile>  
          <id>dev</id>
          <repositories>
            <repository>
              <id>Nexus</id>
              <url>http://139.155.180.*:8081/repository/maven-public/</url>
              <releases>
                <enabled>true</enabled>
              </releases>
              <snapshots>
                <enabled>true</enabled>
              </snapshots>
            </repository>
          </repositories>
        </profile>
    </profiles>
    
    <activeProfiles>
        <activeProfile>dev</activeProfile>
    </activeProfiles>
    
      
    </settings>
    
    

    发布包

     <distributionManagement>
            <repository>
                <id>nexus-releases</id>
                <name>Nexus Release Repository</name>
                <url>http://你的maven地址/repository/maven-releases/</url>
            </repository>
            <snapshotRepository>
                <id>nexus-snapshots</id>
                <name>Nexus Snapshot Repository</name>
                <url>http://你的maven地址/repository/maven-snapshots/</url>
            </snapshotRepository>
        </distributionManagement>
    
    image.png

    如果出现

    from/to central (http://139.155.180.170:8081/repository/maven-public/): Not authorized
    

    检查server对应的id和mirror的id是否一致

    相关文章

      网友评论

          本文标题:nexus maven私服搭建

          本文链接:https://www.haomeiwen.com/subject/yubczltx.html