sbtsbt-onejar

SBT one-jar Plugin Usage


I'm using the one-jar plugin to generate a fat jar file. Here is how my Build.scala looks like:

import com.github.retronym.SbtOneJar
import sbt._
import Keys._

object build extends Build {
  def standardSettings = Seq(
    exportJars := true
  ) ++ Defaults.defaultSettings

  lazy val metricsProducer = Project("metricsProducer",
    file("beta"),
    settings = standardSettings ++ SbtOneJar.oneJarSettings
  )

  libraryDependencies ++= Seq(
    "org.apache.spark" %% "spark-core" % "1.6.0",
    "org.apache.kafka" %% "kafka" % "0.9.0.0"%,
    "joda-time" % "joda-time" % "2.7" %,
    "io.spray" %%  "spray-json" % "1.3.2" %
  )
}

When I tried to run this using:

sbt run one-jar

unresolved dependency: org.scala-sbt.plugins#sbt-onejar;0.8: not found

I have the dependency plug in added in the plugins.sbt. Any clues?


Solution

  • Not sure on sbt one-jar if it is still supported. I managed to get this working using the sbt assembly plugin.

    https://github.com/sbt/sbt-assembly