Installation
hocon is a pure-Scala library with no native dependencies, so there is nothing to install at the system level — just add it to your build.
hocon is a pure-Scala library with no native dependencies, so there is nothing to install at the system level — just add it to your build.
hocon is under active development. The parser, the untyped Config API, object merging,
substitutions, value concatenation, and durations/sizes are in place and tested on all three
platforms; include directives and a typed decoder are on the roadmap.
Requirements
- Scala 3
- sbt
- For Scala.js / Scala Native targets: the usual
sbt-scalajs/sbt-scala-nativeplugins
No java.* dependency is used in the core, and there are no native libraries to link.
Add the dependency
hocon cross-publishes for the JVM, Scala.js, and Scala Native. Use the %%% operator so sbt
picks the right artifact for each platform:
libraryDependencies += "io.github.edadma" %%% "hocon" % "0.0.1"
In a crossProject build the single line covers every target:
lazy val app = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.settings(
libraryDependencies += "io.github.edadma" %%% "hocon" % "0.0.1",
)
From source
To track the latest changes, you can depend on hocon as a source dependency instead. Clone it next to your project:
git clone https://github.com/edadma/hocon.git
and reference the cross-built module by relative path in your build.sbt:
dependsOn(ProjectRef(file("../hocon"), "hocon"))
Verify the setup
hocon’s own suite is pure Scala and runs headlessly on every platform:
sbt hoconJVM/test
sbt hoconJS/test
sbt hoconNative/test
All three run the identical tests — that cross-platform parity is the whole point of the library. Continue to the quick start to parse a config.