Search code examples
scalasbt

What does the syntax @VERSION@ mean in build.sbt?


I assume it's some sort of variable substitution, but I can't find any documentation on it.

I tried google searches and searches of this site. But I think the '@' is causing problems.


Solution

  • So it's from sbt plugin zio-sbt-website

    https://zio.dev/zio-sbt/#zio-sbt-website

    https://github.com/zio/zio-sbt/tree/main/zio-sbt-website

    https://search.maven.org/artifact/dev.zio/zio-sbt-website

    And as we can see in its build.sbt

    addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7")
    

    it uses another sbt plugin sbt-mdoc using Scalameta's mdoc

    https://scalameta.org/mdoc/

    Extensible

    Define custom variables like @VERSION@ or programmatically implement custom modifiers to render tailor-made documentation for your project.

    https://scalameta.org/mdoc/docs/installation.html

    We process the markdown with one of the following mdoc integrations:

    • sbt-mdoc: for usage with sbt projects.
    • command-line: to run from the console outside of a build tool.
    • library API: for programmatic usage.

    Configure site variables like @VERSION@

    Use --site.VARIABLE=value to add site variables that can be referenced from markdown as @VARIABLE@.

    coursier launch org.scalameta:mdoc_2.12:2.3.7 -- \
    +  --site.SCALA_VERSION 2.12.17
    

    https://scalameta.org/mdoc/docs/why.html

    Why mdoc?

    • variable injection: use variables like @VERSION@ to that make sure the documentation stays up-to-date with new releases.

    https://github.com/scalameta/mdoc

    https://mvnrepository.com/artifact/org.scalameta/mdoc

    https://github.com/scalameta/mdoc/tree/main/mdoc-sbt

    https://search.maven.org/artifact/org.scalameta/sbt-mdoc

    So it's basically Scalameta :)