Missing classes from assembly file generated by sbt assembly

I have a project that uses sbt 0.13.6 with build plugin 0.12.0 to build farJar. My build.sbt

:

name := "test"

version := "0.0.1"

scalaVersion := "2.10.4"

libraryDependencies ++= Seq(
  ("org.apache.kafka" % "kafka_2.10" % "0.8.0" % "provided").
    exclude("javax.jms", "jms").
    exclude("com.sun.jdmk", "jmxtools").
    exclude("com.sun.jmx", "jmxri").
    exclude("org.slf4j", "slf4j-simple")
)

      

When I run sbt assembly

, I get a file named target/scala-2.10/test-assembly-0.0.1.jar

, but it is missing some kafka classes, including the one I need at runtime:

> diff <(jar -tf /home/rief/.ivy2/cache/org.apache.kafka/kafka_2.10/jars/kafka_2.10-0.8.0.jar) <(jar -tf target/scala-2.10/test-assembly-0.0.1.jar) | grep "^<"
...
kafka/consumer/ZookeeperConsumerConnector$ZKRebalancerListener$$anonfun$kafka$consumer$ZookeeperConsumerConnector$ZKRebalancerListener$$closeFetchersForQueues$1.class
...

      

Is this the correct behavior? How to include kafka

in my fatJar?

+3


source to share


1 answer


This is the intended behavior. % "provided"

omitted as it intends to provide these classes from a container like Apache Spark, Kafka, etc. If you want everything here you can do:



fullClasspath in assembly := (fullClasspath in Compile).value

      

+1


source







All Articles