Sbt: Is there a better way to structure large build.sbt files

Description of the problem: large sbt file

Our current build.sbtcontains 250 lines.

We have two problems:

readability

current approach for grouping data and comments:

// Plugins ///////////////////////////////////////////////////

enablePlugins(DockerPlugin)

// basic configuration : projects ///////////////////////////
name := """projectName"""

lazy val projectName =
 (project in file(".")).....

reuse of logic

We have some configuration logic that we would like to share between different projects.

Question

Is there any way to include other *.sbtfiles? Or do you have a suggestion to solve this problem without resorting to writing the sbt plugin?

+4
source share
2 answers

Is there any way to include other *.sbtfiles?

, build.sbt *.sbt . SBT *.sbt , .

+4

, , , scala .

. Dependencies.scala , :

object Dependencies {

  val akka_actor = "com.typesafe.akka" %% "akka-actor" % "2.3.13"

  // ...
}

build.sbt:

import Dependencies._

lazy val foo = Project(...) dependsOn (akka_actor, ...)

.

. , , , , - , scala, akka. , scala . AkkaBuild.scala.

+5

Source: https://habr.com/ru/post/1614728/


All Articles