将远程存储库克隆到 Linux 远程计算机后,尝试运行 mvn clean install
时出现以下错误:
[ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] Non-resolvable parent POM: Could not transfer artifact xxxxx
from/to central (http://repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refused and 'parent.relativePath' points at wrong local POM @ line 4, column 10: Connection timed out -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
[ERROR] [Help 2]
这些错误仅在 Linux 上运行 mvn
命令时出现,在 Windows 环境上 mvn clean install
后项目构建成功...
关于为什么在 Linux 机器上发生这种情况有什么想法吗?
谢谢
最佳答案
Connection to http://repo.maven.apache.org refused
以上消息似乎是由于网络故障造成的。正如你所说,它在 Windows 上成功构建,而不是在 Linux 上构建,我想你的 Linux 配置文件中一定有一些不同的网络设置。您添加过任何代理吗?检查maven proxy setting然后再试一次。
关于Maven 全新安装无法从 Maven 中心获取 Artifact ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20880932/