0

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?

Shankar
  • 2,625
  • 3
  • 25
  • 49
  • 1
    you seemed to have a proxy between your artifactory and your build machine which shows there was/is a problem...I recommend to delete the whole local cache and turn on checksum policy to prevent wrong downloads...as this shows... – khmarbaise Oct 03 '19 at 21:04

1 Answers1

3

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>
Shankar
  • 2,625
  • 3
  • 25
  • 49
  • 2
    You are correct, Bintray was recently updated to forward HTTP requests to HTTPS, you can see this in a banner if you go to bintray.com. – Adi Vizgan Oct 07 '19 at 11:26