nexus - 搭建maven私有仓库

nexus /help

  1. 安装windows服务
    nexus /install

  2. 启动nexus服务

  3. 访问http://localhost:8081/
    右上角登陆,提示admin密码在某个文件,查看并输入即可

  4. 配置maven
    配置文件 ~/.m2/settings.xml
    4.1 配置下载依赖时,使用本地的nexus私有仓库
  <mirrors>
    <mirror>
      <id>local-nexus</id>
      <mirrorOf>*</mirrorOf>
      <name>local maven repository</name>
      <url>http://localhost:8081/repository/maven-public/</url>
    </mirror>
  </mirrors>

4.1 为了能上传一些jar包到releases或snapshots仓库,需要做以下配置

  <profiles>  
    <profile>  
      <id>dev</id>  
      <repositories>  
        <repository>  
          <id>nexus-releases</id>  
          <url>http://localhost:8081/repository/maven-releases/</url>  
          <releases>
            <enabled>true</enabled>  
          </releases>  
          <snapshots>  
            <enabled>false</enabled>  
          </snapshots>  
        </repository>  
    <repository>  
          <id>nexus-snapshots</id>  
          <url>http://localhost:8081/repository/maven-snapshots/</url>  
          <releases>
            <enabled>false</enabled>  
          </releases>  
          <snapshots>  
            <enabled>true</enabled>  
          </snapshots>  
        </repository>  
      </repositories>  
    </profile>  
  </profiles>  

  <servers>
    <server>  
      <id>nexus-releases</id>  
      <username>admin</username>  
      <password>password</password>  
    </server>  
    <server>  
      <id>nexus-snapshots</id>  
      <username>admin</username>  
      <password>password</password>  
    </server> 
  </servers>

猜你喜欢

转载自www.cnblogs.com/byrxiaochun/p/12150704.html