401是没有授权的含义
我们要根据setting中的配置在pom.xml文件中进行一些配置
setting:
<server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server> </servers>
pom.xml
<distributionManagement> <repository> <id>releases</id> <name>Nexus Release Repository</name> <url>http://10.1.81.199:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <name>Nexus Snapshot Repository</name> <url>http://10.1.81.199:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
如果出现400错误,检查
repository 和 snapshotRepository 是否配置反了。