Reputation: 43
I have a bunch of Scala files, java files. The Scala files depend on 1 external Scala jar. Now, how do I create a jar out of this ?
I am a newbie to Scala. Could you list out step by step procedure for creating the jar ? I am not working with any IDEs and currently working from Linux Terminal
Thanks in Advance.
Upvotes: 1
Views: 231
Reputation: 10681
Personally, I'm using one-jar with sbt; so that it includes scala libraries automatically. You need to have one main class for that.
src/main/scala
and your java files to src/main/java
project/
plugins.sbt
into it.addSbtPlugin("org.scala-sbt.plugins" % "sbt-onejar" % "0.8")
to plugins.sbt
of your main projectbuild.sbt
and fill it with the following:build.sbt:
name := "Application name"
version := "1.0" // your version number
organization := "ch.epfl.lara" // your organisation or package name
scalaVersion := "2.10.2" // The scala version used
seq(com.github.retronym.SbtOneJar.oneJarSettings: _*)
libraryDependencies += "commons-lang" % "commons-lang" % "2.6"
mainClass in oneJar := Some("YOUR.PACKAGE.AND.MAINCLASS")
Now run sbt one-jar
in command line in your directory and voilà!
Upvotes: 1