Maven build error No versions available for org.codehaus.jackson:jackson-core-asl:jar:[1.8,1.9) within specified range

血红的双手。 提交于 2019-11-28 12:04:47

As pointed by yegor256, whoever is having this problem recently, it is probably caused by Amazon AWS. Just change your aws-java-sdk to a newer version (current is 1.3.20) and the problem will go away.

It would appear that Jackson's jackson-core-asl maven-metadata.xml file has been corrupted.

When Maven attempts to resolve dependency versions from a range, it must look to the maven-metadata.xml file in order to determine the version candidates it can choose from. Currently that file looks like:

<metadata modelVersion="1.1.0">
  <groupId>org.codehaus.jackson</groupId>
  <artifactId>jackson-core-asl</artifactId>
  <versioning>
    <latest>1.1.0</latest>
    <release>1.1.0</release>
    <versions>
      <version>1.1.0</version>
    </versions>
    <lastUpdated>20120928142709</lastUpdated>
  </versioning>
</metadata>

This indicates that the only legal version a version range might choose from is 1.1.0. As an example of what this file most likely looked like before check the jackson-core-lgpl maven-metadata.xml file:

<metadata>
<groupId>org.codehaus.jackson</groupId>
  <artifactId>jackson-core-lgpl</artifactId>
  <version>0.9.8</version>
  <versioning>
    <versions>
      <version>0.9.8</version>
      <version>0.9.7</version>
      <version>0.9.9</version>
      <version>0.9.9-2</version>
      <version>0.9.9-3</version>
      <version>0.9.9-4</version>
      <version>0.9.9-5</version>
      <version>0.9.9-6</version>
      <version>1.0.0</version>
...

As was previously suggested, you can hard code a dependency on a specific version of Jackson which short-circuits the version resolution and avoids reading the maven-metadata.xml file.

I should point out that the latest version of this file (maven-metadata.xml) must be wrong. The latest version for org.codehaus.jackson/jackson-core-asl is 1.9.9.

Other dependencies that required other versions of jackson-core-asl, newer that 1.1.0, will break. As it did on my scenario. I had to manually change the maven-metadata.xml file ok jackson-core-asl to make it work

Maven is unable to find the dependency for jackson-core-asl, you need to include following in your POM

<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-core-asl</artifactId>
    <version>1.9.0</version>
</dependency>

If its already included, then you might have to specify the repository. Check maven repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!