In my project I have the following structure:
src/
plugins/
\__ mpc
|__ oper
I compile all of the scala files in src into a single jar (the main program), then each subdirectory in plugins contains scala files that should build a plugin jar to be loaded by the main program (so one jar for plugins/mpc and another for plugins/oper).
In the root I have a 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 Compile <<= baseDirectory(_ / "src")
mainClass := Some("org.chilon.mrtoms.MrToms")
That builds my main jar file from the files in src just fine.. how do I add jars for the sources file in each plugin directory?
Seems that you need full configuration (at the moment you are using basic one):
https://github.com/harrah/xsbt/wiki/Full-Configuration
In your case, root
project is your main jar. Each plugin should then have it's own project, that root project aggregates. Full configuration can 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"))
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With