1、下载地址 maven
https://archive.apache.org/dist/maven/maven-3/3.8.2/binaries/apache-maven-3.8.2-bin.zip
2、下载地址 nexus
3、开启nexus 服务
C:\Users\Administrator\Desktop\nexus-3.38.0-01-win64\nexus-3.38.0-01\bin
nexus /run start
4、修改密码 admin
5、idea pom 配置 可以发布打包
<!-- 使用分发管理将本项目打成jar包,直接上传到指定服务器 -->
<distributionManagement>
<!--正式版本-->
<repository>
<!-- nexus服务器中用户名:在settings.xml中<server>的id-->
<id>nexus</id>
<!-- 这个名称自己定义 -->
<name>nexus</name>
<url>http://111.231.25.91:8081/repository/maven-releases/</url>
</repository>
<!--快照 版本-->
<snapshotRepository>
<id>maven-snapshots</id>
<name>maven-snapshots</name>
<url>http://111.231.25.91:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
6、setting.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">
<!-- 本地仓库地址 -->
<localRepository>D:\environment\apache-maven-3.8.2\repos</localRepository>
<!-- 以下配置为上传jar包配置 -->
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<!-- id,对应项目里面pom.xml里面distributionManagement配置的id -->
<id>maven-releases</id>
<!-- 登录nexus的用户名 -->
<username>admin</username>
<!-- 登录nexus的密码 -->
<password>admin</password>
</server>
<server>
<!-- id,对应项目里面pom.xml里面distributionManagement配置的id -->
<id>maven-snapshots</id>
<!-- 登录nexus的用户名 -->
<username>admin</username>
<!-- 登录nexus的密码 -->
<password>admin</password>
</server>
<!-- 配置拦截器mirror登录的用户名密码。他会拦截所有的请求到mirror指定的地址下载jar包 如果只需要去私服下载jar包则只需配置此项 -->
<server>
<!-- id,对应mirror中id -->
<id>nexus</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
<!-- 以下配置为下载jar包配置 通用 -->
<mirrors>
<!-- 强制让jar包下载走私服 -->
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://111.231.25.91:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<!-- 对应activeProfiles-activeProfile的内容 -->
<id>nexus</id>
<!-- 仓库地址 -->
<repositories>
<repository>
<!-- 私服id,覆盖maven-model模块下的父id,让maven不走中央仓库下载,走私服下载 -->
<id>central</id>
<!-- 名字 -->
<name>Nexus</name>
<!-- 私服地址,写central后,会去mirror里面找 -->
<url>http://central</url>
<!-- 支持releases版本 -->
<releases>
<enabled>true</enabled>
</releases>
<!-- 支持snapshots版本 -->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<!-- 插件地址 -->
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Nexus Plugin Repository</name>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- 配置全局的url地址 供上传jar包时动态获取 -->
<properties>
<ReleaseRepository>http://111.231.25.91:8081/repository/maven-releases/</ReleaseRepository>
<SnapshotRepository>http://111.231.25.91:8081/repository/maven-snapshots/</SnapshotRepository>
</properties>
</profile>
</profiles>
<!-- 选择使用的profile -->
<activeProfiles>
<activeProfile>nexus</activeProfile>
<!-- <activeProfile>rdc</activeProfile>-->
</activeProfiles>
</settings>