Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sbt : Is there a better way of structuring large build.sbt files

Tags:

scala

build

sbt

Problem description: large sbt file

Our current build.sbt spanns 250+ lines.

We have two problems:

readability

current approach grouping of data and comments:

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

enablePlugins(DockerPlugin)

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

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

logic reuse

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

Question

Is there a way to include other *.sbt files? Or do you have a suggestion how to solve this problem without resorting to write a sbt plugin?

like image 941
Andreas Neumann Avatar asked Dec 25 '22 12:12

Andreas Neumann


1 Answers

Is there a way to include other *.sbt files?

Yes, you can simply put parts of your build.sbt file into other *.sbt files within your project root. SBT picks up all *.sbt files and merges them together, as there was only a single large file.

like image 132
ziggystar Avatar answered Dec 31 '22 11:12

ziggystar