Reposilite--Maven轻量级的私有仓库
前言:
目前maven的私有仓库有几个:
https://github.com/apache/archiva
https://maven.apache.org/repository-management.html
https://github.com/dzikoysk/reposilite
https://releases.jfrog.io/artifactory/bintray-artifactory/
https://github.com/sonatype/nexus-public
目前行业中用得比较多的是 nexus 和 jforg,这两个面对中大型企业来使用还是很合适的,但是它们消耗的资源过大。所以本篇文章向大家介绍安装reposilite这个开源的maven轻量级私有仓库,适合个人开发者,初创企业或小型团队。目前我使用下来内存占用极低,官方推荐32M即可。

官方介绍:
Reposilite (formerly NanoMaven) is a lightweight repository manager for Maven artifacts. It is a simple solution to replace managers like Nexus, Archiva or Artifactory.
Reposilite(前身为NanoMaven)是Maven制品的轻量级存储库管理器。这是一个简单的解决方案来取代Nexus、Archiva或Artifactory。
连接:https://reposilite.com/guide/about
安装教程:
ps:Reposilite使用java开发,所以请提前安装好jdk。
Reposilite supports multiple use cases and environments. By default we support 3 of them:
支持三种安装方式
- run regular JAR file as standalone Java application
直接java -jar启动
- launch Reposilite within Docker container
使用docker或者docker-compose
- manage multiple Reposilite instances using Kubernetes
使用k8s
That's why there're different ways to configure your instance. We divided it into 3 configuration layers:
支持三种配置方式
- Startup configuration
启动参数的方式配置(本文介绍)
Configuration - Local configuration
- Immutable file-based configuration of the given Reposilite instance
本地配置文件方式(本文介绍)
共享型的配置文件,用数据库存储,比如说mysql
- Stores mutable state of Reposilite in database, it's shared between all Reposilite instances and supports hot-reloading of properties
配置数据存储在数据库中,这样子每个Reposilite实例可以共享配置,并完成热更新配置。
You don't have to create configuration files manually, Reposilite will generate it during the first startup, but make sure that process is able to write to the disk.
你不用手动创建配置文件,Reposilite会在第一次启动的时候去创建,请保证设置的配置文件目录有权限读写。
docker-compose方式安装:
Reposilite官方是使用账号(token)密码(secret)方式进行安全认证的,第一次启动时需要添加参数--token admin:secret 来设置一个初始化的账号密码,然后在控制台生成随机密码。第一次docker-compse.yml文件如下:
version: "3.9"
services:
reposilite:
image: dzikoysk/reposilite:3.5.3
ports:
- 8089:8080
environment:
- JAVA_OPTS=-Xmx128m
- REPOSILITE_OPTS=--token admin:secret
volumes:
- /app/reposilite:/app/data
restart: unless-stopped
stdin_open: true
tty: true
volumes:
reposilite-data: {}docker-compose up 启动容器
然后在命令行中输入:token-generate admin m(admin账号创建管理员权限,并生成随机secret)
control+c 关闭容器,修改yml文件
version: "3.9"
services:
reposilite:
image: 192.168.3.32:5000/dzikoysk/reposilite:3.5.3
ports:
- 8089:8080
environment:
- JAVA_OPTS=-Xmx128m
- REPOSILITE_OPTS=--local-configuration=/app/data/configuration.cdn
volumes:
- /app/reposilite:/app/data
restart: unless-stopped
stdin_open: true
tty: true
volumes:
reposilite-data: {}删除了--token admin:secret,增加--local-configuration=/app/data/configuration.cdn(注意自己要挂载的路径,我挂载的是/app/reposilite)
请根据自己的需要修改configuration.cdn,能配置端口号,ssl,数据的存储的数据库,默认为sqlite,mysql等。
配置修改完成后使用命令完成启动:docker-compose up -d
访问ip:8089,即可到达控制台页面:
右上角可以使用admin账号登录
下一期将讲解如何使用reposilite与maven完成结合实战。