文章目录
- 一、nexus3 配置
- 1. 新建仓库概述
- 2. 阿里云代理仓库
- 3. 自己的仓库
- 4. 自己的仓库组
- 二、maven配置
- 2.1. 私服配置
- 2.2. 替换后的配置
- 三、IntelliJ IDEA
- 3.1. 创建项目
- 3.2. 指定配置
- 3.3. 下载依赖
- 四、nexus3 监控
- 4.1. 查看依赖版本
- 4.2. 版本对比
- 4.3. aliyun 仓库地址
一、nexus3 配置
1. 新建仓库概述
总共新建3各仓库
一个是国内开源仓库,加速下载
一个是自己的仓库,用于存放自己公司的jar
一个是子类型的仓库,用于将上述两个组成一个地址
2. 阿里云代理仓库
-点击设置新建仓库
类型选择 (maven2 proxy)
Name
aliyun-proxy
URL
http://maven.aliyun.com/repository/public
3. 自己的仓库
只输入名称,其他的都不用做,默认即可
Name
local-test-release
4. 自己的仓库组
local-test-group 包含了阿里云代理仓库地址以及存放自己jar的仓库地址
Name
local-test-group
将aliyun-proxy和local-test-release 两个仓库都添加进来,保存
二、maven配置
2.1. 私服配置
在本地的maven 配置settings.xml内容,用下面内容覆盖
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>local-test-release</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
<mirrors>
<mirror>
<id>local-test-group</id>
<name>*</name>
<url>http://127.0.0.1:8081/repository/local-test-group/</url>
<!--*指的是访问任何仓库都使用我们的私服-->
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<!-- 私有库地址-->
<repository>
<id>nexus</id>
<url>http://127.0.0.1:8081/repository/local-test-group/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!--插件库地址-->
<pluginRepository>
<id>nexus</id>
<url>http://127.0.0.1:8081/repository/local-test-group/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
2.2. 替换后的配置
三、IntelliJ IDEA
idea 测试
新建项目或者在现有的项目中添加依赖都可以,要是在现有的项目中添加MySQL依赖,刷新maven
3.1. 创建项目
3.2. 指定配置
3.3. 下载依赖
四、nexus3 监控
4.1. 查看依赖版本
这里以spring-boot-starter-web 2.5.7
依赖查看
咱们只要下载过得maven依赖都会上传 nexus3 私服仓库中
4.2. 版本对比
4.3. aliyun 仓库地址
https://developer.aliyun.com/mvn/guide