zella
zella

Reputation: 4685

How to produce jar with sbt assembly without scala dependency

I have simple sbt project with one java class without scala dependency:

package com.example;

class Hello {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

And build.sbt:

name := """test-sbt"""

version := "0.1"

scalaVersion := "2.11.8"

mainClass in assembly := Some("com.example.Hello")

Also assembly.sbt in project/

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")

Command sbt assembly produce one fat jar with scala library inside. How to produce fat jar without scala dependency inside?

Upvotes: 3

Views: 1357

Answers (1)

zella
zella

Reputation: 4685

Found solution in sbt-assembly documentation:

I need add this to build.sbt:

assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)

Upvotes: 4

Related Questions