Search code examples
scalasbtivy

sbt/ivy version ranges does not resolve but exact versions do


I can't seem to get SBT to resolve my dependencies when I use the range syntax.

So

libraryDependencies ++= Seq(
  //exact version works i.e.     0.5.3+27
  //but what we want to work is  [0.5.3,)
  //or I've since moved the build number to the 4th component  0.5.3.+
  "company"                %% "project"      % "0.5.3.+",
  //...
)

I can get exact versions to work fine, but none of the version syntax specified at https://ant.apache.org/ivy/history/2.3.0/ivyfile/dependency.html#revision or the examples on http://www.scala-sbt.org/0.13/docs/Library-Management.html work.

I've looked around and found there was a fix for something like this here https://github.com/sbt/sbt/pull/2075 which went into sbt 0.13.9, I'm using 0.13.11.

The first version range is what I was using because of what Semantic version recommends for meta data in point 10 when that didn't work, the library management docs / Ivy revision docs says "end the revision with a + selects the latest sub-revision of the dependency module", so I removed the + in case that was causing a problem and added the 4th component which is just the build number GoCD provides. Again exact version works but not sub-revisions.

In sbt I can see URL of the two formats being hit:

  1. https://dl.bintray.com/<username>/internal-releases/<namespace>/<project-name>_2.11/[revision]/<project-name>_2.11-[revision].pom
  2. http://dl.bintray.com/<username>/internal-releases/<namespace>/<project-name>_2.11/[revision]/ivys/ivy.xml

Note here [revision] is what is literally in the URL printed. The things in angle brackets are my replacements. Hence why I thought issue 2005 was related. I don't have an SBT repositories file.

So for the question, have I been doing something wrong in the above, how do I get version range work with the min.minor.patch.build syntax i.e. 0.x.x.+?


Solution

  • Worked around this. Bintray directory listings doesn't have valid HTTP links (anti-crawler effort on Binary's part.) As a result the Ivy resolver fails to fetch the list of published versions.

    Using the maven layout instead of Ivy's works out because Maven format includes a metadata.xml which lists all available versions. So the work around is to republish libs using the maven layout instead of Ivy's to get this meta data.