New sbt "feature" configuration not found in X / unresolved (transitive) dependencies - scala

A rather recent new "feature" in sbt, perhaps 0.13.7 or 0.13.8, is a very annoying behaviour that transitive dependencies are not found any longer.
For example. I have a project A that depends on library B version 1.25.1 that depends on library C version 1.13.1. Only library dependency B is defined in A, naturally, because I don't want to define the whole tree of dozens of sub-libraries. Ok, this builds.
Now I update the dependency in A to become library B version 1.25.2 which in turn depends on library C version 1.13.2. Now sbt complains with the rather useless message "configuration not found in library-C;1.13.2: 'master'. It was required from library-B;1.25.2 compile", followed by an "unresolved dependency" exception. Sbt doesn't even bother to download library C version 1.13.2 from Maven Central or in fact find it already published locally. The only way to "solve" this is to add a depenency on library C version 1.13.2 to project A, which is precisely what I don't want to do.
Here is an example print out:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: de.sciss#scalacolliderugens-core_2.11;1.13.2: configuration not found in de.sciss#scalacolliderugens-core_2.11;1.13.2: 'master'. It was required from de.sciss#scalacolliderswing-core_2.11;1.25.2 compile
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] de.sciss:scalacolliderugens-core_2.11:1.13.2
[warn] +- de.sciss:scalacolliderugens-plugins_2.11:1.13.2
[warn] +- de.sciss:scalacolliderswing-core_2.11:1.25.2 (/home/hhrutz/Documents/devel/SoundProcesses/build.sbt#L167)
[warn] +- de.sciss:soundprocesses-compiler_2.11:2.20.0-SNAPSHOT
I suppose this is an annoying bug in sbt, or is there some deeper reasoning behind the failure to resolve transitive dependencies that I fail to understand?

The problem even came back a while after I had added library C explicitly. As often, the final solution was this:
$ rm -r ~/.ivy2/cache/
$ rm -r ~/.ivy2/local/
And then download the Internet again.

Related

sbt scripted plugin fails as an unresolved dependency on publishing cross-compiled scala versions

Our play-googleauth library is built on Scala 2.12, and cross-compiled to Scala 2.11, using sbt 1.1.6. As the library is intended to be run in Play projects, we've historically provided an example standalone Playframework project that uses the library, so that users can see how to set it up.
I recently added the sbt plugin scripted to the project, so that by running the sbt command scripted we could check the example project works correctly. However, I now find that our release process fails:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-sbt#scripted-sbt_2.11;1.1.6: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.scala-sbt:scripted-sbt_2.11:1.1.6 ((sbt.ScriptedPlugin.projectSettings) ScriptedPlugin.scala#L43)
[warn] +- com.gu:play-googleauth_2.11:0.7.7-SNAPSHOT
If you clone the repo and checkout the scripted-plugin-fails-to-resolve tag you can reproduce this by running sbt +publishLocal.
What's going wrong here? Is the problem that scripted is intended for development of sbt plugins rather that Scala libraries (if so, is there a good alternative)? I know that scripted is used in Play 2.6, which cross compiles to both Scala 2.12 & 2.11.
Maven Central indicates scripted-plugin 1.1.6 is not published for 2.11.
Play 2.6 uses SBT 0.13.17 and so fetches scripted-plugin 0.13.17

Using berkeley hardfloat

I am using Chisel3 in my project. I tried to import hard float library as folow:
import chisel3._
import hardfloat._
but unfortunately, I am getting:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: edu.berkeley.cs#hardfloat_2.11;1.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
I went through couple of repositories that used hardfloat and found out that I was missing this line in my build.sbt:
libraryDependencies ++= Seq("edu.berkeley.cs" %% "hardfloat" % "1.2")
but unfortunately I am still getting the error. I then tried to compile projects that use hardfloat without any modification (for example soundkit) but I still get the same error. I used both terminal and InteliJ to compile my project and got the same result. For some reason, the hardfloat library is not even shows up in the External Libraries in IntelliJ .
I would really appreciate it if someone let me know what might be the issue.
pedrofurla was right. After talking to folks at RISC-V, I got to know that, as you said, the hardfloat is not published to somewhere that sbt can download it. In order to use the library, one has to build and publish it locally:
git clone https://github.com/ucb-bar/berkeley-hardfloat.git hardfloat
cd hardfloat
sbt publish-local
Note: the library works with chisel2

Installing ensime in existing project cannot resolve dependency

I started an android project in scala recently, I'm an emacs nerd, and I wanted to use ensime in emacs instead of IntelliJ. Per the installation instructions, and this post:
Installing Ensime for Scala Development on emacs: sbt.ResolveException: unresolved dependency: org.ensime#ensime-sbtt-cmd;0.12: not found
my ~/.sbt/plugins/plugins.sbt looks like this:
resolvers += "Sonatype releases" at "https://oss.sonatype.org/content/repositories/snapshots"
addSbtPlugin("org.ensime" % "ensime-sbt-cmd" % "0.1.2")
and my project's project/plugins.sbt looks like this:
addSbtPlugin("org.scala-sbt" % "sbt-android" % "0.7.1-SNAPSHOT")
(though I don't think that's related).
When I run sbt, the output looks like the following:
[info] Loading global plugins from /Users/jmiles/.sbt/plugins
[info] Updating {file:/Users/jmiles/.sbt/plugins/}default-bdeac8...
[info] Resolving org.ensime#ensime-sbt-cmd;0.1.2 ...
[warn] module not found: org.ensime#ensime-sbt-cmd;0.1.2
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.ensime/ensime-sbt-cmd/scala_2.9.2/sbt_0.12/0.1.2/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/org.ensime/ensime-sbt-cmd/scala_2.9.2/sbt_0.12/0.1.2/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/jmiles/.ivy2/local/org.ensime/ensime-sbt-cmd/scala_2.9.2/sbt_0.12/0.1.2/ivys/ivy.xml
[warn] ==== Sonatype releases: tried
[warn] https://oss.sonatype.org/content/repositories/snapshots/org/ensime/ensime-sbt-cmd_2.9.2_0.12/0.1.2/ensime-sbt-cmd-0.1.2.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/ensime/ensime-sbt-cmd_2.9.2_0.12/0.1.2/ensime-sbt-cmd-0.1.2.pom
[info] Resolving org.scala-sbt#precompiled-2_10_0-m7;0.12.1 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.ensime#ensime-sbt-cmd;0.1.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] org.ensime:ensime-sbt-cmd:0.1.2 (sbtVersion=0.12, scalaVersion=2.9.2)
[warn]
sbt.ResolveException: unresolved dependency: org.ensime#ensime-sbt-cmd;0.1.2: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:214)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:114)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:114)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:102)
at sbt.IvySbt.liftedTree1$1(Ivy.scala:49)
(etc.)
Any help?
I get this all the time with dependencies. While I have no explanation for it, here are the common patterns that recur over and over.
Often, the code given by the plugin/library developer is wrong. When I go to their maven repository the version they have listed doesn't exist in the repository. I just update it to the right version and then boom it works. Also, for some reason some plugins work when I put them in plugins.sbt (the suggested place). While others only work if I stick them in project/build.sbt. It doesn't make sense, but as soon as I move it there it suddenly installs and runs. Combined dependency listings. If you are hacking stuff together and stick a dependency in both build.scala and build.sbt, it will throw a generic error that is completely unhelpful. Remove one or the other and suddenly it runs.
Also keep in mind that % causes a scala version to be appended to the name of it. whereas %% defines the name explicitly. Sometimes this causes errors when using % because it doesn't have a version available for that scala version. Go to the repository and enter the name of the package explicitly to fix this.
ensime 0.1.2 is only for sbt version 0.13.x. If this is a new project, you might consider using the current version of sbt. Typically you'd do this by creating project/build.properties that contains sbt.version=0.13.0

Understanding How SBT, Scala, SBT-Idea and Play Framework Work Together

I am new and had built some simple Scala applications / tutorials using SBT. I move on to Play framework and generated an empty project using g8 typesafehub/play-scala. I did a few tests to make sure it was properly generated. That checked out good and I added sbt-idea plugin, https://github.com/mpeltonen/sbt-idea, to generate an IntelliJ project. This is where the hell broke loose.
I had to find the right Scala, SBT, Play framework and sbt-idea versions combinations to get it compiled perfectly. Otherwise, the compilation would broke with out right errors or warnings that got me guessing. So far, the best "combination" I had was
Scala 2.9.2
Play 2.0.1
SBT 0.11.2
sbt-idea 1.1.0
with the following warning
[warn] [NOT FOUND ] maven-plugins#maven-cobertura-plugin;1.3!maven-cobertura-plugin.plugin (282ms)
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/maven-plugins/maven-cobertura-plugin/1.3/maven-cobertura-plugin-1.3.plugin
[warn] [NOT FOUND ] maven-plugins#maven-findbugs-plugin;1.3.1!maven-findbugs-plugin.plugin (284ms)
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/maven-plugins/maven-findbugs-plugin/1.3.1/maven-findbugs-plugin-1.3.1.plugin
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: maven-plugins#maven-cobertura-plugin;1.3!maven-cobertura-plugin.plugin
[warn] :: maven-plugins#maven-findbugs-plugin;1.3.1!maven-findbugs-plugin.plugin
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
If I use the latest versions, SBT 0.12 and Play 2.0.3 I would get a complilating error. Any idea or explanation how I can get all these works together nicely? It is a version mess to me right now. Thanks
I think that you should start with Play from the original site: http://www.playframework.org/ you'll find there newest stable version for download (currently it's 2.0.3).
It contains proper dependencies and its installation is as easy as unpacking the ZIP and exporting the path as described in: Installing doc.
I can ensure you that this approach is the easiest and most sure way, it works as expected, creates proper IntelliJ projects etc. If I'm not wrong IntelliJ support was fixed after 2.0.1 also other indices had some improvements, so there is no sense to fight with 2.0.1 if it isn't really required.

Cannot install new 0.11.3 sbt on Ubuntu 10.04LTS

This process used to work fine in 0.11.2 but the recent change w.r.t to sbt group ID changed to org.scala-sbt (from org.scala-tools.sbt) seems to have broken a dependency.
I've got a 10.04 LTS machine to which I added the Typesafe deb repository using the deb package file, described in: https://github.com/harrah/xsbt/wiki/Getting-Started-Setup.
When I try to install from the repo I get:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-tools.sbt#scripted-plugin_2.9.1;0.11.3: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] module not found: org.scala-tools.sbt#scripted-plugin_2.9.1;0.11.3
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/scripted-plugin_2.9.1/0.11.3/ivys/ivy.xml
[warn] ==== local: tried
[warn] /home/jasonmaclulich/.ivy2/local/org.scala-tools.sbt/scripted-plugin_2.9.1/0.11.3/ivys/ivy.xml
[warn] ==== Typesafe Repo: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/scripted- plugin_2.9.1/0.11.3/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-tools/sbt/scripted-plugin_2.9.1/0.11.3/scripted-plugin_2.9.1-0.11.3.pom
How do I instruct sbt to look for scripted-plugin at the right group id?
I also tried a manual install with this launcher (following the UNIX install instructions):
//typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.11.3-2/sbt-launch.jar
And I still get the following unresolved dependency:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-tools.sbt#scripted-plugin_2.9.1;0.11.3: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
Thoughts?
Thanks, Jason.
I thought I'd update this with how I got around it, if I explicitly set the version of sbt to 0.11.2 in my project/build.properties file, i.e., sbt.version=0.11.2.
Detected sbt version 0.11.2
Cannot find sbt launcher 0.11.2
Please download:
From http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/0.11.2/sbt-launch.jar
To /home/<username>/.sbt/.lib/0.11.2/sbt-launch.jar
I then installed the required files and I was able to continue compiling like I was used to.
While it isn't a direct solution it does let me continue with work.
I've installed latest SBT on Ubuntu successfully, but indirectly, by installing Typesafe Stack.
By now, sbt-0.11.3-build-0100 is available (http://apt.typesafe.com/pool/pool/main/s/sbt/), so you should be able to simply upgrade to solve your problem. If that doesn't work or if you're curious about the original problem, here's my diagnosis.
As you tried to do, you do need to use a new launcher for SBT 0.11.3 to use the new group ID, org.scala-sbt. Your second error message still shows a failure which refers to org.scala-tools.sbt - that's bad, and suggests you're in fact still using the old launcher.
Could you make sure that when you're launching sbt, you're launching the script you created and not the one from the Debian package? Please try using the full path for launching sbt, for instance ~/bin/sbt.
If that helps, you should fix the PATH so that ~/bin (or wherever you installed your script) comes before the directory where the system SBT is installed, which (I would say, but it's a matter of opinion) is generally useful.