9

I am building a sbt plugin and want to reference assembly task in the sbt-assembly plugin ( to be dependent on my task)

to do this i need to reference it as a library ( as opposed to a plugin), and somehow sbt is not able to resolve it as a libraryDepdendencies

this is what my sbt looks like

sbtPlugin := true

name := "my-sbt-plugin"

scalaVersion := "2.10.6"

sbtVersion := "0.13.0"

resolvers ++= Seq(Resolver.sbtPluginRepo("releases"), Resolver.sbtPluginRepo("snapshots"))

libraryDependencies ++= Seq(
  "com.eed3si9n" % "sbt-assembly" % "0.13.0")

the output looks like

Resolving com.eed3si9n#sbt-assembly;0.13.0 ...
[warn]  module not found: com.eed3si9n#sbt-assembly;0.13.0
[warn] ==== typesafe-ivy-releases: tried
[warn]   https://repo.typesafe.com/typesafe/ivy-releases/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== local: tried
[warn]   /Users/myuser/.ivy2/local/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly/0.13.0/sbt-assembly-0.13.0.pom
[warn] ==== sbt-plugin-releases: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== sbt-plugin-snapshots: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.eed3si9n#sbt-assembly;0.13.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
np-hard
  • 5,725
  • 6
  • 52
  • 76
  • answer to this question is below, but only the part that says add plugin directive to build.sbt – np-hard Mar 16 '16 at 16:55

5 Answers5

7

It is not resolving because you did not specify a scala version. It should be something like:

libraryDependencies ++= Seq(
    "com.eed3si9n" % "sbt-assembly_2.11" % "0.13.0"
)

Or, to automatically get the scala version used in project:

libraryDependencies ++= Seq(
    // notice the double %% here
    "com.eed3si9n" %% "sbt-assembly" % "0.13.0"
)

But, sbt-assembly is not supposed to be installed that way. The docs show that you must add the following line to your project/plugins.sbt instead:

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.2")

If developing an sbt plugin, the addSbtPlugin line has to go directly into ./build.sbt.

0__
  • 66,707
  • 21
  • 171
  • 266
marcospereira
  • 12,045
  • 3
  • 46
  • 52
  • no luck :(, now its looking for https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly_2.10/0.13.0/ivys/ivy.xml – np-hard Mar 02 '16 at 19:58
  • Apologies - I just tried. It seems the plug-ins are differently resolved, e.g. [here](https://dl.bintray.com/sbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.10/sbt_0.13/0.14.2/). You are right, one has to call `addSbtPlugin`, but not inside `project/plugins.sbt` but, for plug-in development, directly in `./build.sbt`! Took the liberty to revert your edit. – 0__ Mar 02 '16 at 20:16
  • @np-hard did you figure out how to resolve this - I've been wasting time on the same thing – ali haider Mar 14 '16 at 15:16
  • 1
    @alihaider looks like this answer helped @np-hard to solve his/her problem. Basically, if you are **using** sbt-assembly plugin, you can add `addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.2")` to your `project/plugins.sbt` file, but if you are **extending** it and your project depends on sbt-assembly internal code instead of its tasks, then you must add `addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.2")` to `build.sbt` file. – marcospereira Mar 14 '16 at 15:21
  • thanks @marcospereira I have tried adding addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.2") to assembly.sbt (as per the sbt site), I tried it in plugins.sbt but neither worked. Can you please refer to a build.sbt and plugins.sbt/assembly/sbt for a project that actually worked? Could it be the scala version I am using (2.11.7) - do I need to downgrade? SBT version I am using is 0.13.9. I posted a question as well in case you wish to answer. http://stackoverflow.com/questions/35975079/trying-to-use-sbt-assembly – ali haider Mar 14 '16 at 15:29
  • The docs now say one has to add `addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")` to `project/assembly.sbt` . – asmaier Jun 21 '17 at 14:53
7

In my case, correcting the sbt assembly version from 14.3 to 14.5 did the trick. Please check what's yours and try that.

So in the project\assembly.sbt , it was like-

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")

Then I changed it to-

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")

Hope it helps!

Mudit
  • 123
  • 2
  • 7
2

It is not resolving for Scala - 2.12.

Add the following line in - project/plugins.sbt -

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

To find the proper path, try the following -

https://dl.bintray.com/sbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_<version>/

So, using version 2.12, the resolvable path can be found as below -

https://dl.bintray.com/sbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.5/ivys/
Arijeet Saha
  • 1,118
  • 11
  • 23
1

In addition to the above suggestions I had to add

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

to project/plugins.sbt.

Prasad Rao
  • 21
  • 1
1

I had the same issues, All I did was, remove the ==>

addSbtPlugin("com.eed3si9n" %% "sbt-assembly" % "0.14.5")

line from build.sbt and copied to another file, named assembly.sbt at the same project level, where build.sbt is.

It resolved the error.(After 3 hours of reading all posts on the internet. :-) )

Yusuf Arif
  • 21
  • 2