sbtnexusivy

Why does SBT resolve SNAPSHOT version?


Here are my resolvers:

resolvers in ThisBuild ++= Seq(
  "Sonatype Nexus Repository Manager" at "https://.../repository/maven-snapshots/",
  "Sonatype Nexus Repository Manager" at "https://.../repository/maven-releases/")

Here is how dependency is specified:

libraryDependencies += a %% b % "1.+"

Nexus contains 1.0.0 in maven-releases

Here is the log I get:

[FAILED     ] a#b_2.11;1.0.0-SNAPSHOT!b_2.11.jar:  (0ms)
[warn] ==== local: tried
[warn]   /Users/me/.ivy2/local/a/b_2.11/1.0.0-SNAPSHOT/jars/b_2.11.jar
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/.../b_2.11/1.0.0-SNAPSHOT/b_2.11-1.0.0-SNAPSHOT.jar
[warn] ==== local-preloaded-ivy: tried
[warn]   /Users/me/.sbt/preloaded/a/b_2.11/1.0.0-SNAPSHOT/jars/b_2.11.jar
[warn] ==== local-preloaded: tried
[warn]   file:////Users/pavelvoronin/.sbt/preloaded/.../b_2.11/1.0.0-SNAPSHOT/b_2.11-1.0.0-SNAPSHOT.jar
[warn] ==== Sonatype Nexus Repository Manager: tried
[warn]   https://.../repository/maven-snapshots/.../b_2.11/1.0.0-SNAPSHOT/b_2.11-1.0.0-SNAPSHOT.jar
[warn] ==== Sonatype Nexus Repository Manager: tried
[warn]   https://.../repository/maven-releases/.../b_2.11/1.0.0-SNAPSHOT/b_2.11-1.0.0-SNAPSHOT.jar

Why does it look for SNAPSHOT? And does not notice 1.0.0?

Some lines from Ivy docs:

end the revision with a + selects the latest sub-revision of the dependency module. For instance, if the dependency module exists in revision 1.0.3, 1.0.7 and 1.1.2, "1.0.+" will select 1.0.7.


Update

After I cleaned Ivy cache it started just telling me that 1.+ is not found. And here are some logs from Nexus:

2017-10-18 11:51:07,030+0000 DEBUG [qtp219355933-2530] user org.sonatype.nexus.repository.view.Router - Request: Request{action=‘HEAD’, path=‘/.../b_2.11/maven-metadata.xml’, parameters={}, payload=HttpRequestPayloadAdapter{contentType=‘null’, size=-1}, multipart=false}

2017-10-18 11:51:07,031+0000 DEBUG [qtp219355933-2530] user org.sonatype.nexus.repository.view.handlers.BrowseUnsupportedHandler$MatcherImpl - Matching: HEAD /.../b_2.11/maven-metadata.xml

2017-10-18 11:51:07,034+0000 DEBUG [qtp219355933-2530] user org.sonatype.nexus.repository.view.Router - Response: Response{status=Status{successful=false, code=404, message=‘.../b_2.11/maven-metadata.xml’}, payload=null}

Solution

  • The problem is that standard sbt pack does not create maven-metadata.xml file.

    With Aether-deploy plugin everything works fine.