A Scala monorepo project built with sbt, demonstrating modular architecture with multiple subprojects.
This monorepo contains the following subprojects:
- core: Core functionality and base classes
- utils: Utility functions that depend on core
- examples: Example applications demonstrating the use of other modules
- Java 11 or higher
- sbt 1.9.7 or higher
-
Clone the repository:
git clone <repository-url> cd singularity
-
Build the project:
sbt compile
-
Run tests:
sbt test -
Run examples:
sbt "examples/run"
sbt compile- Compile all subprojectssbt test- Run all testssbt "core/test"- Run tests for core module onlysbt "utils/test"- Run tests for utils module onlysbt "examples/run"- Run the examples applicationsbt clean- Clean build artifactssbt reload- Reload sbt configuration
- core: No dependencies (base module)
- utils: Depends on core
- examples: Depends on both core and utils
To add a new subproject:
- Create a new directory for your subproject
- Add the subproject definition to
build.sbt - Update the root project's
aggregatesetting to include the new subproject - Create the standard
src/main/scalaandsrc/test/scaladirectory structure
Example subproject definition in build.sbt:
lazy val newModule = (project in file("new-module"))
.settings(
name := "singularity-new-module",
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "0.7.29" % Test
)
)
.dependsOn(core) // if it depends on core- Language: Scala 3.3.1
- Build Tool: sbt 1.9.7
- Testing: MUnit
- Organization: com.singularity
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run
sbt testto ensure all tests pass - Submit a pull request