SBT Dependency Resolution Failure with vespa.ai - scala

I've added Vespa to an sbt project:
libraryDependencies += "com.yahoo.vespa" % "vespa-http-client" % "6.225.3"
Which results in the following module resolution failure:
[warn] Detected merged artifact: [FAILED ] com.yahoo.vespa#component;6.225.3!component.container-plugin: (0ms).
[warn] Detected merged artifact: [FAILED ] com.yahoo.vespa#vespajlib;6.225.3!vespajlib.container-plugin: (0ms).
[warn] ==== local: tried
[warn] ==== local: tried
[warn] ==== public: tried
[warn] ==== public: tried
[warn] ==== local-preloaded-ivy: tried
[warn] https://repo1.maven.org/maven2/com/yahoo/vespa/component/6.225.3/component-6.225.3.container-plugin
[warn] C:\Users\gary\.sbt\preloaded\com.yahoo.vespa\vespajlib\6.225.3\container-plugins\vespajlib.container-plugin
[warn] ==== local-preloaded-ivy: tried
[warn] ==== local-preloaded: tried
[warn] C:\Users\gary\.sbt\preloaded\com.yahoo.vespa\component\6.225.3\container-plugins\component.container-plugin
[warn] file:/C:/Users/gary/.sbt/preloaded/com/yahoo/vespa/vespajlib/6.225.3/vespajlib-6.225.3.container-plugin
[warn] ==== local-preloaded: tried
[warn] file:/C:/Users/gary/.sbt/preloaded/com/yahoo/vespa/component/6.225.3/component-6.225.3.container-plugin
Failed with both an older version and latest sbt (1.1.1).

SBT uses the artifact's packaging type as file extension by default. Our pom.xml for the component artifact (and quite a few others) uses packaging type container-plugin, while the actual jar file of course has the standard jar suffix.
So you need to configure SBT manually with the file suffix for those artifacts. I don't know if there's a convenient way to do this for a set of dependencies at once, as I'm not an SBT expert. But for each individual artifact where you get this error, you could try the following:
libraryDependencies += "com.yahoo.vespa" % "component" % "6.225.3" artifacts( Artifact("component", "", "jar"))
I found it in this SO answer and haven't tested it myself. Perhaps you can find some useful information in the SBT reference manual on Using dependencies with artifacts.

Here are the dependencies of vespa-http-cient:
https://github.com/vespa-engine/vespa/blob/master/vespa-http-client/pom.xml
I don't know SBT very well, maybe you need to explicitly include those dependencies, or specify to include transitive dependencies.

Related

activator dist failing when using Scala 2.12.0

I updated the scala version in my build.sbt file to 2.12.0 from 2.11.8.
scalaVersion := "2.12.0"
But now activator dist is failing with the following errors. Please advise:
[info] Resolving com.typesafe.play#twirl-api_2.12;1.1.1 ...
[warn] module not found: com.typesafe.play#twirl-api_2.12;1.1.1
[warn] ==== local: tried
[warn] /home/ubuntu/.ivy2/local/com.typesafe.play/twirl-api_2.12/1.1.1/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/typesafe/play/twirl-api_2.12/1.1.1/twirl-api_2.12-1.1.1.pom
[warn] ==== activator-launcher-local: tried
[warn] /home/ubuntu/activator/repository/com.typesafe.play/twirl-api_2.12/1.1.1/ivys/ivy.xml
[warn] ==== typesafe-releases: tried
[warn] https://repo.typesafe.com/typesafe/releases/com/typesafe/play/twirl-api_2.12/1.1.1/twirl-api_2.12-1.1.1.pom
[warn] ==== typesafe-ivy-releasez: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.play/twirl-api_2.12/1.1.1/ivys/ivy.xml
One of your dependencies (twirl-api) has not been released for Scala 2.12. You need to remove this dependency, get it published on 2.12, or else stay on Scala 2.11.

IDEA 15 cannot resolve build.sbt after create SBT project

As the title, I've tried most solutions on the internet, but it still not work.
But I can still load my old SBT projects!
It just can't create a new one.
Remove .lock file under ~./ivy2 and ~/.sbt => not work
Change sbt and scala version (Current version is SBT 13.9, Scala 2.11.7) => not work
Invalidate cache and restart => not work
Set SDK/Java path => not work
Reinstall => not work
Does anyone know what's going on?
01:01:48 SBT project import
[warn] [FAILED ] org.scala-sbt#compiler-interface;0.13.9!compiler-interface.jar(src): (0ms)
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== local: tried
[warn] /Users/WeiChen/.ivy2/local/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== activator-local: tried
[warn] /Users/WeiChen/activator-dist-1.3.6/repository/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== activator-launcher-local: tried
[warn] /Users/WeiChen/.activator/repository/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/scala-sb..
It seems like a bug on IDEA 15, I temporally downgrade to IDEA 14 to avoid this problem.
Try re-importing the project.
Select your build.sbt from the tree, then in the following dialog, make sure Sources for SBT and plugins is ticked.

Unable to resolve scalajs-sbt-plugin dependency

I just tried to clone https://github.com/scala-js/scalajs-tutorial and I get this:
[info] Resolving org.scala-lang.modules.scalajs#scalajs-sbt-plugin;0.5.5 ...
[warn] module not found: org.scala-lang.modules.scalajs#scalajs-sbt-plugin;0.5.5
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scala-lang.modules.scalajs/scalajs-sbt-plugin/scala_2.10/sbt_0.13/0.5.5/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-lang.modules.scalajs/scalajs-sbt-plugin/scala_2.10/sbt_0.13/0.5.5/ivys/ivy.xml
[warn] ==== local: tried
[warn] C:\Users\Joan\.ivy2\local\org.scala-lang.modules.scalajs\scalajs-sbt-plugin\scala_2.10\sbt_0.13\0.5.5\ivys\ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-lang/modules/scalajs/scalajs-sbt-plugin_2.10_0.13/0.5.5/scalajs-sbt-plugin-0.5.5.pom
I also opened an issue here
Cheers
Qote from https://github.com/scala-js/scalajs-tutorial/issues/3:
This resolver is supposed to be used by default by sbt >= 0.13.0.
And this has all been working fine for a year. Now suddenly people start having this issue :-s This doesn't make any sense.
Workaround: add explicitly the following resolver in project/plugins.sbt:
resolvers += Resolver.url(
"bintray-sbt-plugin-releases",
url("https://dl.bintray.com/content/sbt/sbt-plugin-releases")
)(Resolver.ivyStylePatterns)

org.scala-sbt#sbt;0.12.3: not found

I have fought with that for several days but still no luck :(
Tried to add some "resolvers" etc. But I have no any right direction to move along.
Looks like no org.scala-sbt#sbt;0.12.3
but I can access http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.12.3/ivys/ivy.xml
using my browser (so artifact is available).
I'm behind the proxy server btw, but I have a feeling that it doesn't matter.
Here is a log:
[info] Loading project definition from C:\proj\blogger-example\project
[info] Updating {file:/C:/proj/blogger-example/project/}default-265363...
[info] Resolving com.github.mpeltonen#sbt-idea;1.4.0 ...
[info] Resolving commons-io#commons-io;2.0.1 ...
[info] Resolving org.scala-sbt#sbt;0.12.3 ...
[warn] module not found: org.scala-sbt#sbt;0.12.3
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.12.3/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/org.scala-sbt/sbt/0.12.3/ivys/ivy.xml
[warn] ==== local: tried
[warn] C:\Users\oabakumov\.ivy2\local\org.scala-sbt\sbt\0.12.3\ivys\ivy.xml
[warn] ==== Typesafe Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/org/scala-sbt/sbt/0.12.3/sbt-0.12.3.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.12.3/sbt-0.12.3.pom
[info] Resolving org.scala-lang#scala-library;2.9.2 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-sbt#sbt;0.12.3: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: org.scala-sbt#sbt;0.12.3: not found
My build.sbt file:
name := "blogger-example"
version := "1.0"
My project\plugins.sbt file:
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.4.0")
Make sure the proxy is set also correctly in the shell (or command prompt).
E.g on a windows 7 machine, set the following environment variable
HTTP_PROXY = myproxy.com:1234
I opened my update.log file (.sbt\boot directory) today. And detailed log helped me to dig in correct direction. I had HTTP 403 error (meant "you has no access to that resource"). So - the question was in my environment settings (SBT settings - sbtconfig.txt).
So... My advice - when nothing clear with your build - go to the log file.

Local dependencies resolved by SBT but not by Play! Framework

I'm trying to use banana-RDF, a locally published library (published using SBT's publish-local) from a Play! Framework project, but when running compile from Play's console, the wanted library is not resolved, when using compile from SBT's console everything goes fine.
I find this behavior pretty weird as Play uses SBT to resolve dependencies. By the way, I'm using the 0.12.3 version of SBT in my Play project.
The error I'm getting when compiling with Play is pretty basic:
[warn] module not found: org.w3#banana_2.10;2013_02_21-SNAPSHOT
[warn] ==== local: tried
[warn] /home_local/.installedSoftware/play-2.1.1/repository/local/org.w3/banana_2.10/2013_02_21-SNAPSHOT/ivys/ivy.xml
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Typesafe Snapshots Repository: tried
[warn] http://repo.typesafe.com/typesafe/snapshots/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Akka Snapshots: tried
[warn] http://repo.akka.io/snapshots/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== OSS117: tried
[warn] http://oss.sonatype.org/content/repositories/snapshots/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Local Maven Repository: tried
[warn] file:///home_local/.m2/repository/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Local SBT Repository: tried
[warn] file:///home_local/.ivy2/local/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
Can anyone explain what is happening here? Thank you in advance.
The problem is that SBT's publish-local publishes your library to ~/.ivy2/local, whereas Play seems to have his ivy2 local repository pointer to the ivy2 repository of his own installation folder (your /home_local/.installedSoftware/play-2.1.1/repository/local).
You can add for example this resolver to your Play's Build.scala:
resolvers += Resolver.file("Local repo", file(System.getProperty("user.home") + "/.ivy2/local"))(Resolver.ivyStylePatterns)