简体   繁体   中英

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. This build setup has worked without issues, but now I am seeing this error every time it gets a new library from Artifactory repo.

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.

<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/ ).

Is Artifactory calling jcenter.bintray to get details of the library? If that is the case, how can we configure Artifactory to use the https URL or to understand the http redirect?

This issue is not related to Artifactory.

It was because there was a reference to http://jcenter.bintray.com in the pom file.

<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.

<!-- Updated http url -->
<repository>
   <id>bintray-central</id>
   <name>bintray</name>
   <url>https://jcenter.bintray.com</url>
</repository>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM