1.先修改maven的setting.xml文件
<server>
<id>nhfframework</id> //仓库名
<username>admin</username> //登录仓库对应的用户名
<password>123456</password> //登录仓库对应的密码
</server>
<server>
<id>nhfframework-snapshots</id> //仓库名
<username>admin</username> //登录仓库对应的用户名
<password>nhfc99</password> //登录仓库对应的密码
</server>
2.增加发布管理节点
<distributionManagement>
<repository>
<id>nhfframework</id>
<name>nhfframework</name>
<url>http://localhost:8081/repository/framework/</url>
</repository>
</distributionManagement>
snapshotRepository
: 快照仓库
repository
: 发行仓库
id
: 仓库名
name
: 自己定义,都可以,为了自己能够识别即可
url
: 仓库地址,自己私服仓库地址
3.发布上传至仓库
或者 mvn deploy进行发布
4.使用
在pom.xml文件中使用仓库地址
<repositories> <repository> <id>wwybase</id> <name>wwybase</name> <url>http://localhost:8081/repository/wwybase/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories>