Alexey Romanov
Alexey Romanov

Reputation: 170713

Add a config to all projects in SBT

I have

lazy val p1 = Project(...).configs(IntegrationTest)

lazy val p2 = Project(...).configs(IntegrationTest)

// etc (quite a few subprojects)

I can share settings between projects by using e.g. scalaVersion in ThisBuild := "2.11.7" without need for repeating .settings(commonSettings) for each project.

Is there an equivalent for configurations, so I don't need to repeat .configs each time either?

Upvotes: 2

Views: 287

Answers (1)

Ajay Padala
Ajay Padala

Reputation: 2401

As sbt can just use scala expressions, You could try putting all projects in a List/Seq and calling foreach on them.

List(p1, p2).foreach(_.settings(commonSettings))

You could try getting list of projects from sbt by looking at

buildStructure.value.allProjects

and calling foreach on that, but not sure whether that would work.

Upvotes: 1

Related Questions