Closed shuttj closed 12 years ago
Ok, I figured out how to exclude the scala-library.jar, but still not sure how to exclude a dependency marked as compile.
You can do something like:
mappings in oneJar <<= (mappings in oneJar).map { (old: Seq[(File, String)] =>
old.filterNot(_._1.getName == "excluded.jar")
}
In which file shall I place these lines?
mappings in oneJar <<= (mappings in oneJar).map { (old: Seq[(File, String)] =>
old.filterNot(_._1.getName == "excluded.jar")
}
I found the above example did not work because of the unmatched parenthesis in front of the var old: Below works for excluding scoverage when it is added to plugins.sbt.
mappings in oneJar <<= (mappings in oneJar).map { depends: Seq[(File, String)] => depends.filterNot(_._1.getName == "scalac-scoverage-runtime_2.11-1.2.0.jar") }
For declared dependancies in your build sbt you can append % "test" like protobuffs and ScalaTest below
libraryDependencies` ++= Seq( "org.json4s" %% "json4s-native" % "3.4.1", "org.scalaj" %% "scalaj-http" % "2.3.0", "com.rabbitmq" % "amqp-client" % "3.6.5", "com.google.protobuf" % "protobuf-java" % "3.1.0" % "test", "org.scalatest" %% "scalatest" % "3.0.0" % "test")
Is there a way to exclude certain lib jars? For example, I don't want to include the scala-library.jar since I am using this in a java only project. Also, I have a library that is needed for compilation only and not at runtime.