3

I am using scala version 2.11.7

I want to build a jar file from sbt which can be executed on a machine where scala is not installed.

I guess i have to package the scala-library.jar in my jar file.

Based on some googling, I think I will have to use the assembly plugin of sbt

I added a new file called assembly.sbt to my project and added the following lines

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

but when I do a sbt package I get an error

[warn]  Note: Unresolved dependencies path:
[warn]      com.eed3si9n:sbt-assembly:0.14.0 (sbtVersion=0.13, scalaVersion=2.11) (/Users/foo/git/AvroCopyUtil/assembly.sbt#L1-2)
[warn]        +- default:avrocopyutil_2.11:1.0
sbt.ResolveException: unresolved dependency: com.eed3si9n#sbt-assembly;0.14.0: not found
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:291)
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:188)
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:165)
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
Onilton Maciel
  • 3,559
  • 1
  • 25
  • 29
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
  • I think you want the `assembly` task, i.e., `$ sbt assembly`. – isomarcte Nov 01 '15 at 23:59
  • when I do `sbt assembly` I get error `[error] Not a valid command: assembly [error] Not a valid project ID: assembly [error] Expected ':' (if selecting a configuration) [error] Not a valid key: assembly [error] assembly [error] ^` – Knows Not Much Nov 02 '15 at 00:49
  • 1
    The `assembly.sbt` goes int `project/` folder – Onilton Maciel Nov 02 '15 at 01:15
  • You nailed it... that's the answer. could you please post your response as an answer so that I can mark it as such! thanks a lot for your help – Knows Not Much Nov 02 '15 at 01:47

1 Answers1

2

The assembly.sbt must go inside the project/ folder.

Onilton Maciel
  • 3,559
  • 1
  • 25
  • 29