下载nexus,本地启动
nexus 2.12.0下载地址
链接: https://pan.baidu.com/s/1JsGDO_5LNavm1RXrhl5Kfg
提取码: mrpr
下载到本地解压缩
在nexus-2.12.0-01-bundle\nexus-2.12.0-01\bin目录下打开命令窗口,执行命令 ./nexus.bat console
启动成功后,本地打开http://localhost:8081/nexus/
进到nexus页面,使用账号admin密码admin123可以登录
手动下载仓库索引文件
访问http://repo1.maven.apache.org/maven2/.index/
拉到最后下载nexus-maven-repository-index.properties
和nexus-maven-repository-index.gz这两个文件;
下载解压工具链接: https://pan.baidu.com/s/1Wh3T8iFz8GdWOKfLSyq8Uw
提取码: j4eu
将解压工具和上面下载的两个文件放到本地一个文件夹里,然后在文件夹里打开命令窗口
执行命令
java -jar indexer-cli-5.1.1.jar -u nexus-maven-repository-index.gz -d indexer
执行完之后,会出现一个indexer文件夹
将nexus目录里\sonatype-work\nexus\indexer\central-ctx下的文件全部删掉
把indexer下的所有内容都复制进来。
关闭重新打开nexus,再nexus网页central仓库就能看到索引文件
上传自己的私有jar包
以ojdbc为例,在本地的nexus页面中选择仓库3rdParty,按照pom.xml的dependency填写
本地maven全局更换仓库下载地址
进入maven安装目录,
在settings.xml中添加
// An highlighted block
<localRepository>这里填写jar包下载保存路径</localRepository>
再mirrors标签中添加
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
</mirror>