Scala multi-module project?

后端 未结 1 654
刺人心
刺人心 2021-01-23 03:40
  • I have Java background and thinking of learning Scala.
  • One of this things that I like about using Maven is that I can make
1条回答
  •  情话喂你
    2021-01-23 04:28

    You can definitely do it. It's called SBT Multi-Project build. You can define one master project and multiple child projects with something like this (from the docs link above):

    import sbt._
    import Keys._
    
    object HelloBuild extends Build {
        lazy val root = Project(id = "hello",
                                base = file(".")) aggregate(foo, bar)
    
        lazy val foo = Project(id = "hello-foo",
                               base = file("foo"))
    
        lazy val bar = Project(id = "hello-bar",
                               base = file("bar"))
    }
    

    Each project can be built separately, you can also package each into a separate JAR, or combine them all into a single master JAR. Each project can define it's own dependencies, but they can also be shared if needed. Basically you have full control. Take a look at my project build file here for example.

    0 讨论(0)
提交回复
热议问题