[英]Maven build fails due to error in “maven-metadata-bintray-central.xml” file
I build a project using Maven that refers to artifacts from Artifactory.我使用 Maven 构建了一个项目,该项目引用来自 Artifactory 的工件。 This build setup has worked without issues, but now I am seeing this error every time it gets a new library from Artifactory repo.
此构建设置没有问题,但现在每次从 Artifactory 存储库获取新库时我都会看到此错误。
Caused by: org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException: Unable to read local copy of metadata: Cannot read metadata from '/home/user/.m2/repository/com/cc-spring-hibernate/5.1-SNAPSHOT/maven-metadata-bintray-central.xml': end tag name </body> must match start tag name <hr> from line 5 (position: TEXT seen ...</center>\r\n</body>... @6:8)
at org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.resolve(DefaultRepositoryMetadataManager.java:175)
at org.apache.maven.artifact.transform.AbstractVersionTransformation.resolveVersion(AbstractVersionTransformation.java:65)
at org.apache.maven.artifact.transform.SnapshotTransformation.transformForResolve(SnapshotTransformation.java:63)
... 23 more
When I checked the maven-metadata-bintray-central.xml file, I see that it has this content.当我检查 maven-metadata-bintray-central.xml 文件时,我看到它有这个内容。
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
Upon investigation I found that this appears to be because of Artifactory calling http://jcenter.bintray.com/ to get a dependency, but the HTTP call returns the "302 Found" & nginx message to redirect to HTTPS ( https://jcenter.bintray.com/ ). Upon investigation I found that this appears to be because of Artifactory calling http://jcenter.bintray.com/ to get a dependency, but the HTTP call returns the "302 Found" & nginx message to redirect to HTTPS ( https:// jcenter.bintray.com/ )。
Is Artifactory calling jcenter.bintray to get details of the library? Artifactory 是否调用 jcenter.bintray 来获取库的详细信息? If that is the case, how can we configure Artifactory to use the https URL or to understand the http redirect?
如果是这种情况,我们如何配置 Artifactory 以使用 https URL 或了解 http 重定向?
This issue is not related to Artifactory.此问题与 Artifactory无关。
It was because there was a reference to http://jcenter.bintray.com in the pom file.这是因为 pom 文件中有对http://jcenter.bintray.com的引用。
<repository>
<id>bintray-central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
I am not sure why it did not fail earlier.我不知道为什么它没有早点失败。 I am assuming there has been a recent change in the jcenter.bintray.com site to redirect all calls for http to https with a 302. Changing the bintray URL to https, like this, deleting the old files in.m2 folder and rebuilding resolved the issue.
I am assuming there has been a recent change in the jcenter.bintray.com site to redirect all calls for http to https with a 302. Changing the bintray URL to https, like this, deleting the old files in.m2 folder and rebuilding resolved问题。
<!-- Updated http url -->
<repository>
<id>bintray-central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.