docker - Maven 错误未知主机 repo.maven.apache.org
问题描述
我正在尝试docker-compose build
在 CentOS Linux 版本 8.2.2004 上构建一个 docker 容器。当我执行命令时,我收到以下错误消息
[ERROR] Plugin org.apache.maven.plugins:maven-javadoc-plugin:3.1.1 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-javadoc-plugin:jar:3.1.1:
Could not transfer artifact org.apache.maven.plugins:maven-javadoc-plugin:pom:3.1.1 from/to central (https://repo.maven.apache.org/maven2):
Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-javadoc-plugin/3.1.1/maven-javadoc-plugin-3.1.1.pom:
Unknown host repo.maven.apache.org: Temporary failure in name resolution -> [Help 1]
[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] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
ERROR: Service 'web' failed to build: The command '/bin/sh -c mvn clean package -am -DskipTests -Dmaven.javadoc.skip=true -P deployment' returned a non-zero code: 1
当我在本地机器上构建 docker 容器时,它工作得很好。因此容器或其中的任何配置都没有问题。我做了一些研究,表明 CentOS 服务器上可能存在代理问题,但echo "$HTTP_PROXY"
返回echo "$HTTPS_PROXY"
一个空行 - 因此我想没有使用代理。
此外,当我执行时,curl https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-javadoc-plugin/3.1.1/maven-javadoc-plugin-3.1.1.pom
我会得到一个外观正确的 xml 文件。
当我执行时,curl https://repo.maven.apache.org/maven2
我得到
<html>
<head><title>302 Moved Temporarily</title></head>
<body>
<h1>302 Moved Temporarily</h1>
<ul>
<li>Code: Found</li>
<li>Message: Resource Found</li>
<li>RequestId: 235378792B04A00C</li>
<li>HostId: b2HKaI47VR5MaiW8bmG9FUGxgZ7u97XeT5Bfm/rs54wVSNjH0hNQsZ2/d4sGaACGboThVlIo5iM=</li>
</ul>
<hr/>
</body>
</html>
curl -L https://repo.maven.apache.org/maven2
向我展示了一个长的 html 文档(如预期的那样)。
任何帮助将不胜感激
解决方案
推荐阅读
- python - Discord 机器人加入 VC
- ios - 删除 tableview 单元格不会更新索引
- c# - Postgres CITEXT 在 DBeaver 中查询时有效,但在 postman 或 swagger 中通过 API 调用时无效
- php - 如何用变量替换子字符串?
- swift - 更改状态模型后需要按两次恢复“自动预览更新已暂停”
- c++ - 有没有办法可以在 C++ 中编辑文件的中间
- r - 在 R 中导入的 data.frame 中将“\\”替换为“\”
- spring-mvc - 如果发布请求包含外部 ID,如何在 Spring 控制器中设置关联记录?
- javascript - 如何将等待功能链接在一起
- node.js - 使用 EJS 时是否需要在 Server.js 文件中使用 { hbs.registerPartials(__dirname + '/views/partials');} 之类的方法?