请求http://repo1.maven.org/maven2/返回501 HTTPS必需状态和正文 [英] Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body
问题描述
自2020年1月15日起,我在向中央存储库提出请求后收到以下答复:
As of January 15, 2020 I am receiving the following responses upon making requests to The Central Repository:
对 http://repo1.maven.org/maven2/的请求返回501 HTTPS状态和身体:
Requests to http://repo1.maven.org/maven2/ return a 501 HTTPS Required status and a body:
501 HTTPS必需. 使用 https://repo1.maven.org/maven2/ 有关详细信息,请参见 https://links.sonatype.com/central/501-https-required 请求 http://repo.maven.apache.org/maven2/返回501 HTTPS所需状态和正文:
501 HTTPS Required. Use https://repo1.maven.org/maven2/ More information at https://links.sonatype.com/central/501-https-required Requests to http://repo.maven.apache.org/maven2/ return a 501 HTTPS Required status and a body:
501 HTTPS必需. 使用 https://repo.maven.apache.org/maven2/ 有关详细信息,请参见 https://links.sonatype.com/central/501-https-required 如何满足此要求,以便我可以重新获得对Central的访问权限?
501 HTTPS Required. Use https://repo.maven.apache.org/maven2/ More information at https://links.sonatype.com/central/501-https-required How do I satisfy this requirement so that I can regain access to Central?
我在控制台中收到此错误
I got this error in the console
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< >----------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from : http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/3.12.0/mongo-java-driver-3.12.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.136 s
[INFO] Finished at: 2020-01-16T15:27:53+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project demo: Could not resolve dependencies for project com.tcs:demo:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at org.mongodb:mongo-java-driver:jar:3.12.0: Failed to read artifact descriptor for org.mongodb:mongo-java-driver:jar:3.12.0: Could not transfer artifact org.mongodb:mongo-java-driver:pom:3.12.0 from/to central (http://repo1.maven.org/maven2/): Failed to transfer http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/3.12.0/mongo-java-driver-3.12.0.pom. Error code 501, HTTPS Required -> [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/DependencyResolutionException
并使用网站插件:
[错误]无法在my-proj项目上执行目标org.apache.maven.plugins:maven-site-plugin:2.2:site(默认站点):SiteToolException:无法从存储库解析站点描述符: ArtifactResolutionException:无法找到站点描述符:无法将工件org.xy:name:xml:site_en:3.5.1.b550从中央转移到中央( http://repo1.maven.org/maven2 ):
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:2.2:site (default-site) on project my-proj: SiteToolException: The site descriptor cannot be resolved from the repository: ArtifactResolutionException: Unable to locate site descriptor: Could not transfer artifact org.x.y:name:xml:site_en:3.5.1.b550 from/to central (http://repo1.maven.org/maven2): Transfer failed for http://repo1.maven.org/maven2/org/x/y/3.5.1.b550/name-3.5.1.b550-site_en.xml 501 HTTPS Required
推荐答案
从2020年1月15日开始,中央存储库不再支持通过纯HTTP进行的不安全通信,并且要求对存储库的所有请求都通过HTTPS进行加密.
Effective January 15, 2020, The Central Repository no longer supports insecure communication over plain HTTP and requires that all requests to the repository are encrypted over HTTPS.
如果收到此错误,则需要用其规范的HTTPS副本替换所有对Maven Central的URL引用:
If you're receiving this error, then you need to replace all URL references to Maven Central with their canonical HTTPS counterparts:
将 http://repo1.maven.org/maven2/替换为将 http://repo.maven.apache.org/maven2/替换为 https://repo.maven.apache.org/maven2/
如果出于任何原因您的环境不支持HTTPS,则可以选择在 http://insecure.repo1.maven.org/maven2/
If for any reason your environment cannot support HTTPS, you have the option of using our dedicated insecure endpoint at http://insecure.repo1.maven.org/maven2/
有关转向HTTPS的更多背景信息,请参见 https://blog .sonatype.com/central-repository-moving-to-https .
For further context around the move to HTTPS, please see https://blog.sonatype.com/central-repository-moving-to-https.
这篇关于请求http://repo1.maven.org/maven2/返回501 HTTPS必需状态和正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!