45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:Nexus架构Maven私服

Nexus架构Maven私服

2019-04-17 08:43:55 来源:www.45fan.com 【
  • 下载镜像
  • 创建存储
  • 部署容器
  • 编写Maven配置文件
  • 编写Maven项目pom文件
  •  

    (一)下载镜像

    #> docker pull sonatype/nexus3

     

    (二)创建存储

    #> mkdir /sre/nexus-data && chown -R 200 /sre/nexus-data

     

    (三)部署容器

    #> docker run -d -p 8081:8081 --name nexus -v /sre/nexus-data:/nexus-data sonatype/nexus3

     

    (四)编写Maven配置文件

    <?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>  # 默认用户名admin 
      <password>admin123</password>  # 默认用户密码
     </server>  
     <server>  
      <id>nexus-snapshots</id>  
      <username>admin</username>  
      <password>admin123</password>  
     </server>   
     
    </servers>
    
    
    <mirrors>
      
     <mirror> 
          <id>nexus</id> 
          <mirrorOf>*</mirrorOf> 
          <name>Nexus Mirror</name> 
          <url>http://ip-address:8081/repository/maven-public/</url> 
     </mirror> 
    </mirrors>
    
     
     <profiles>
      
     <profile> 
          <id>nexus</id> 
          <repositories> 
            <repository> 
              <id>nexus</id> 
              <name>local private nexus</name> 
              <url>http://ip-address:8081/repository/maven-public/</url> 
              <releases> 
                <enabled>true</enabled> 
              </releases> 
              <snapshots> 
                <enabled>false</enabled> 
              </snapshots> 
            </repository> 
            <repository> 
              <id>nexus</id> 
              <name>local private nexus</name> 
              <url>http://ip-address:8081/repository/maven-public/</url> 
              <releases> 
                <enabled>false</enabled> 
              </releases> 
              <snapshots> 
                <enabled>true</enabled> 
              </snapshots> 
            </repository> 
     
          </repositories> 
          <pluginRepositories> 
            <pluginRepository> 
              <id>nexus</id> 
              <name>local private nexus</name> 
              <url>http://ip-address:8081/repository/maven-public/</url> 
              <releases> 
                <enabled>true</enabled> 
              </releases> 
              <snapshots> 
                <enabled>false</enabled> 
              </snapshots> 
            </pluginRepository> 
            <pluginRepository> 
              <id>nexus</id> 
              <name>local private nexus</name> 
              <url>http:/ip-address:8081/repository/maven-public/</url> 
              <releases> 
                <enabled>false</enabled> 
              </releases> 
              <snapshots> 
                <enabled>true</enabled> 
              </snapshots> 
            </pluginRepository> 
          </pluginRepositories> 
        </profile> 
     </profiles>
     <activeProfiles> 
        <activeProfile>nexus</activeProfile> 
      </activeProfiles> 
     
    </settings>
    

     

    (五) 编写Maven项目pom文

    <distributionManagement>
      <repository>
        <id>nexus</id>
        <name>local private nexus</name>
        <url>http://ip-address:8081/repository/maven-public/</url>
      </repository>
    </distributionManagement>

     

     
     

    本文地址:http://www.45fan.com/a/question/100397.html
    Tags: Nexus 架构 MAVEN
    编辑:路饭网
  • 上一篇:HDFS架构简述
  • 下一篇:没有了
  • 关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部