Plugin Development
If you need some extra features MongoCamp Server does not offer you, you can extend your instance by write your own plugin. A Sample Implementation you can see in our ShowCase Sample Plugin.
Scala 3
MongoCamp Server is built with Scala 3. A plugin has to be built with Scala 3 as well: depend on the _3 artifacts of the server ("dev.mongocamp" %% "mongocamp-server" in sbt) and compile with a Scala 3 compiler that is at least as new as the one the server was built with (scalaVersion in the build.sbt of the server), otherwise sbt can not resolve the dependencies of the server (or the compiler can not read its API). Plugins published for Scala 2.13 (_2.13 artifacts) are not supported by a Scala 3 server.
import dev.quadstingray.sbt.json.JsonFile
val json = JsonFile(file("package.json"))
name := json.stringValue("name")
organization := json.stringValue("organization")
scalaVersion := "2.13.10"
libraryDependencies += "dev.mongocamp" %% "mongocamp-server" % "1.4.0"
publishTo := Some("GitHub Package Registry".at("https://maven.pkg.github.com/mongocamp/mongocamp-sample-plugin/"))
credentials += Credentials("GitHub Package Registry", "maven.pkg.github.com", System.getenv("GITHUB_USER"), System.getenv("GITHUB_TOKEN"))
mainClass := Some("dev.mongocamp.server.Server")You can add all your extra dependencies to your build.sbt. If you use the preferred way to import plugins all dependencies are resolved automatically.
To make your own plugin functional and loaded you have to implement one of this Scala Traits:
