使用Nexus搭建Maven私服(二)-更新私有仓库索引
上一节内容已经介绍如何安装安装Nexus搭建Maven私服,本章具体介绍更新私有仓库索引的方式
更新私有仓库索引的方式
(1)设置Central Repository --》 Download Remote Indexes:True 打开自动更新仓库索引
该种方式通过远程下载更新私有仓库,由于文件过大,且访问一些国外下载地址,更新较慢,基本上很难进行完成更新,推荐使用手动更新
(2)手动更新仓库索引
自动方式更新私有仓库索引
--》访问搭建的Nexus服务,http://ip:port/nexus
--》使用默认用户名/密码:admin/admin123,进行登录
--》设置Central Repository --》 Download Remote Indexes:True 打开自动更新仓库索引
--》查询下载任务(一般情况下全部下载速度时非常慢的这里我们取消采用手动更新)
--》取消下载任务
--》完成
手动方式更新私有仓库索引
下载索引文件
(1)indexer-cli-5.1.0.jar
下载地址:http://maven.outofmemory.cn/org.apache.maven.indexer/indexer-cli/5.1.0/
(2)nexus-maven-repository-index.gz
下载地址:https://repo.maven.apache.org/maven2/.index/
(3)nexus-maven-repository-index.properties
下载地址:https://repo.maven.apache.org/maven2/.index/
手动更新步骤
--》进入Nexus安装目录,创建index目录上传下载文件
--》进入index目录
cd /usr/local/nexus2.14/index
--》执行命令,解压nexus-maven-repository-index.gz包需要耗费一段时间,需耐心等待解压完成
java -jar indexer-cli-5.1.0.jar -u nexus-maven-repository-index.gz -d indexer
--》停止nexus服务
cd /usr/local/nexus2.14/nexus-2.14.13-01/bin
./nexus stop
--》删除原有的索引文件(这里需注意一定检查一下是否是central-ctx目录,不要错误其他目录将所有文件删除了,特别是跟目录)
cd /usr/local/nexus2.14/sonatype-work/nexus/indexer/central-ctx
ls
rm -rf *
--》将解压的所有索引文件拷贝到central-ctx目录
cd /usr/local/nexus2.14/index/indexer
ls
cp -r * /usr/local/nexus2.14/sonatype-work/nexus/indexer/central-ctx
--》启动nexus
cd /usr/local/nexus2.14/nexus-2.14.13-01/bin
./nexus start
--》访问nexus的web服务,登录查看索引是否更新完成
--》完成