1. 自行启动了个 Nenux 服务。想把本地工程推送到 个人私服,执行命令:mvn deploy 报错:
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy
(default-deploy) on project gentle:
Failed to retrieve remote metadata com:gentle:1.0-SNAPSHOT/maven-metadata.xml:
Could not transfer metadata com:gentle:1.0-SNAPSHOT/maven-metadata.xml
from/to user-snapshots (http://xx.xx.xx.xx:8081/nexus/content/repositories/snapshots/):
Connect to xx.xx.xx.xx:8081 [/xx.xx.xx.xx] failed: Connection refused: connect -> [H
2. 原因: 我的 私服 服务挂了。
重启了一下就 OK 了。
3. 另外注意 :maven 配置文件 setting.xml 中私服 id 要和项目 pom.xml 中配置的 id 一致:
1.这是在pom.xml 中:
<distributionManagement>
<!--JY - 私服-->
<repository>
<id>releases</id>
<name>Nexus Release Repository</name>
<url>http://此处是服务器IP:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://此处是服务器IP:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
2.这是在 setting.xml 中:
<servers>
<!-- JY 私服配置 -->
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>