解決:Connect to xx.xx.xxx.xx :8081 [/xx.xx.xx.xx] failed: Connection refu sed: connect -> [H
阿新 • • 發佈:2018-12-10
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>