scalasbtscalatestsbt-crossproject

sbt: disable testing in certain sub-modules


My project has several module, like

At the moment testing does only work for the JVM modules.

What I can do is:

sbt sharedJVM/test server/test

What I want do is:

sbt test

I couldn't find a Setting to do this.


Solution

  • You can take advantage of aggregatedProjects as below:

    lazy val aggregatedProjects: Seq[ProjectReference] = Seq(
      server,
      sharedJVM
    )
    
    lazy val root = project
      .in(file("."))
      .aggregate(aggregatedProjects: _*)
    

    Once you do this, then whatever command you execute at root project level will be propagated to aggregated projects. Which means by running sbt test will execute sbt server/test and sbt sharedJVM/test