思路:
1、修改maven的setting.xml文件
2、pom.xm文件中添加配置
3、注意id要一致
详细如下:
1、修改maven的setting.xml文件,找到里面的 servers 标签,在里面添加配置,用户名和密码填写私服的用户名和密码,要注意id,和下面的pom.xml文件中的id一致
<servers> <server> <id>hidata-releases</id> <username>jack</username> <password>1232!@#</password> </server> <server> <id>hidata-snapshots</id> <username>jack</username> <password>1232!@#</password> </server> </servers>
2、pom.xm文件中添加配置
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> .................此处省.......................... <repositories> <repository> <id>hidata-releases</id> <name>hidata nexus</name> <url>http://www.haixinde.com:8081/repository/maven-public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <distributionManagement> <repository> <id>hidata-releases</id> <name>Hidata Project Release</name> <url>http://www.haixinde.com:8081/repository/maven-releases</url> </repository> <snapshotRepository> <id>hidata-snapshots</id> <name>Hidata Project SNAPSHOTS</name> <url>http://www.haixinde.com:8081/repository/maven-snapshots</url> </snapshotRepository> </distributionManagement> </project>