What is the best way to generate separate jar files using sbt for multiple main classes under the same source tree?
The project directory looks something like this:
project_root/
src/main/scala/
A/*.scala files for main class A
B/*.scala files for main class B
resources/
test/scala/
A/
B/
lib/
project/Build.scala
build.sbt
Notice that both A and B have the same base. Concrete examples of Build.scala file would be helpful.
Jar files can contain only one Main-Class attribute in the manifest, which means a jar can contain only one mainClassName.
You should have a look at Getting Started Multi Project. I made a simple example below:
import sbt._
object MyBuild extends Build {
lazy val projA = Project("projA", file("a"))
lazy val projB = Project("projB", file("b"))
}
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