Sonatype Nexus 搭建本地私有 Maven 仓库
安装 nexus 服务
首先下载 Nexus Repository OSS,地址: www.sonatype.com/products/re…
填写信息后点击 DOWNLOAD,选择对应 OS 版本。
以 nexus-3.42.0-01-unix.tar.gz 为例,下载完成后解压:
tar -xzvf nexus-3.42.0-01-unix.tar.gz
在 nexus-3.42.0-01/bin 目录下执行:
./nexus run
开启成功:
此时浏览器打开 http://localhost:8081/ 就可以打开 nexus 的控制面板了。
默认端口修改
nexus 默认端口为 8081,可能由于默认端口被占用导致启动失败:
Linux 可根据端口查找进程
sudo lsof -i:
修改 nexus-3.42.0-01/etc 目录下的 nexus-default.properties 的 application-port:
## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
##
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/
# Nexus section
nexus-edition=nexus-pro-edition
nexus-features=\
nexus-pro-feature
nexus.hazelcast.discovery.isEnabled=true
登录 nexus
用户名为 admin,默认密码在 sonatype-work\nexus3 目录下 admin.password 中,首次登录会提示修改密码。
手动上传 aar
登录后点击 upload,选择一个仓库:
点击 Upload,就完成了上传。
引用 AAR
添加 maven 仓库:
maven {
allowInsecureProtocol = true
url 'http://172.20.217.6:8080/repository/maven-releases/' }
然后 build.gradel 添加对应 aar 依赖。