Using the sbt-osgi plugin, one can create 'fat jars' by using the OsgiKeys.embeddedJars
attribute.
For example the following code (extracted from this test) embedds every dependency with a name starting with jUnit
into the compiled jar:
OsgiKeys.embeddedJars := (Keys.externalDependencyClasspath in Compile).value map (_.data) filter (
_.getName startsWith "junit")
In my case I have dependencies declared as follows:
libraryDependencies += "org.apache.logging.log4j" % "log4j-api" % "2.7" % Provided
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % akkaVersion
I would like every library to be embedded into the fat jar except for the ones annoated with Provided
. So in this case com.typesafe.akka
should be included in the fat jar while org.apache.logging.log4j
should not be compiled into the jar.
Is there any way to modify the filter method above so that it fulfills my requirement?