How to create multiple jar files using scala sbt

In my project, I have the following structure:

CSI /

plugins /

\ __ mpc

| __ oper

I will compile all scala files in src into one jar (the main program), then each subdirectory in the plugins contains scala files that should build a jar of the plugin for loading by the main program (so there is one jar for plugins / mpc and one more for plugins / oper) .

In the root, I have build.sbt:

name: = "mrtoms"

Organization: = "chilon"

version: = "0.1"

libraryDependencies ++ = Seq ("commons-httpclient"% "commons-httpclient"% "3.1")

crossPaths: = false

scalaHome: = Some (file ("/ usr / share / scala"))

target: = file ("project / target")

scalaSource in compilation <= lt; = baseDirectory (_ / "src")

mainClass: = Some ("org.chilon.mrtoms.MrToms")

This builds my main jar file from files in src just fine. How to add jars for the source file in each plugin directory?

+4
source share
1 answer

It seems that you need the full configuration (at the moment you are using the basic one):

https://github.com/harrah/xsbt/wiki/Full-Configuration

In your case, the root project is your main bank. Each plugin must have its own project, which is combined with the root project. A complete configuration might be something like this:

 import sbt._ object MyBuild extends Build { lazy val root = Project("root", file(".")) aggregate (mpc, oper) lazy val mpc = Project("mpc", file("plugins/mpc")) dependsOn(pluginApi) lazy val oper = Project("sub2", file("plugins/oper")) dependsOn(pluginApi) lazy val pluginApi = Project("pluginApi", file("plugins/api")) } 
+6
source

All Articles