maven私服搭建

1. 私服搭建的意义

  1. 是为了进行仓库的管理和控制,以及减少对中心仓库的访问,减少网络请求提高效率。
  2. 以及为内网用户在无法访问外网却需要使用maven功能
  3. 发布自己的组件到私服

2. 所用工具Nexus Repository Manager (NXRM)

NXRM是一个仓库管理工具,能够实现上节所提到的三种特性,它不仅支持maven还支持其他多种仓库形式:

Repository Formats:

  • Maven Repositories with Apache Maven and Other Tools
  • .NET Package Repositories with NuGet
  • Private Registry for Docker
  • Node Packaged Modules and npm Registries
  • Bower Repositories
  • PyPI Repositories
  • Ruby, RubyGems and Gem Repositories
  • Raw Repositories, Maven Sites and More
  • Git LFS Repositories
  • Yum Repositories

另外,NXRM还提供有web用户界面。

3. NXRM服务器的搭建

NXRM支持*unix,OSX,windows,Docker等多种平台。最新版本是Nexus Repository Manager (NXRM) 3,此次使用的平台及版本为nexus-3.13.0-01-unix

3.1 linux下安装

此次安装和配置主要参考文章:Linux 使用 Nexus3.x 搭建 Maven 私服指南

在安装之前首先参考如下不同之处:

3.1.1 其中所用版本略有不同
  1. 下载页面
  2. 选择nexus-3.13.0-01-unix版本,进行下载
3.1.2 默认8081端口修改
  1. $NEXUS_HOME/nexus-3.13.0-01/etc/nexus-default.properties中的application-port=8081修改为想要的端口,如application-port=9001