Question

I have a multiproject sbt build file like this

import sbt._                                                                                                                                                                                                                           
import Keys._                                                                                                                                                                                                                          

object TestBuild extends Build {                                                                                                                                                                                                       
  lazy val root = Project(id = "test",                                                                                                                                                                                                 
    base = file(".")) aggregate(core, handlers)                                                                                                                                                                                        

  lazy val core = Project(id = "test-core",                                                                                                                                                                                            
    base = file("core"))                                                                                                                                                                                                               

  lazy val handlers = Project(id = "test-handlers",                                                                                                                                                                                    
    base = file("handlers")) dependsOn (core)                                                                                                                                                                                          
}  

How can I build an assembly-jar that includes all the dependencies + core + handlers

Was it helpful?

Solution

Ok I solved this problem using

import sbt._                                                                                                                                                                                                                           
import Keys._                                                                                                                                                                                                                          

object TestBuild extends Build {                                                                                                                                                                                                       
  lazy val root = Project(id = "test",                                                                                                                                                                                                 
    base = file(".")) aggregate(core, handlers) dependsOn(core,handlers)                                                                                                                                                                                        

  lazy val core = Project(id = "test-core",                                                                                                                                                                                            
    base = file("core"))                                                                                                                                                                                                               

  lazy val handlers = Project(id = "test-handlers",                                                                                                                                                                                    
    base = file("handlers")) dependsOn (core)                                                                                                                                                                                          
}  

I put the assembly settings in the build.sbt file

OTHER TIPS

You can use sbt-assembly plugin.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top