Sbt-assembly unresolved dependency, Scala

user2827214 picture user2827214 · Sep 22, 2015 · Viewed 7.9k times · Source

I'm installing Sbt-Assembly, but am now stuck.

Sbt Version (from 'sbt about'): 0.13.8
Current project is built against scala 2.11.6
Sbt, sbt plugins, and build definitions are using Scala 2.10.4

project/assembly.sbt

   addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.0")
   resolvers += Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)

build.sbt

   scalaVersion in ThisBuild := "2.11.6"

~/.sbt/0.13/global.sbt

   scalaVersion := "2.11.6"

I realize sbt-assembly is for scala 2.10. If I change my project to scala 2.10, I have new unavailable dependencies for 2.10 which is not desirable. Is there a way to configure my project to use 2.10 just for the assembly plugin?

  ==== bintray-sbt-plugins: tried
  http://dl.bintray.com/sbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.11/sbt_0.13/0.14.0/ivys/ivy.xml

  ::::::::::::::::::::::::::::::::::::::::::::::
  ::          UNRESOLVED DEPENDENCIES         ::
  ::::::::::::::::::::::::::::::::::::::::::::::
  :: com.eed3si9n#sbt-assembly;0.14.0: not found
  ::::::::::::::::::::::::::::::::::::::::::::::

  Note: Some unresolved dependencies have extra attributes.  
  Check that these dependencies exist with the requested attributes.

      com.eed3si9n:sbt-assembly:0.14.0 (scalaVersion=2.11, sbtVersion=0.13)

Answer

Alexey Romanov picture Alexey Romanov · Sep 22, 2015

Just remove scalaVersion from global.sbt.

Because SBT is recursive it uses this scalaVersion from global.sbt when building your build files, which fails because SBT 0.13 is built with Scala 2.10, and so are all SBT plugins.