Skip to content

sbt-riddl Plugin

The sbt-riddl plugin integrates RIDDL validation into your Scala/sbt build process. This allows you to validate RIDDL models as part of your normal compilation workflow.

Installation

Add to your project/plugins.sbt:

addSbtPlugin("com.ossuminc" %% "sbt-riddl" % "1.0.0")

Replace 1.0.0 with the latest version.

Configuration

In your build.sbt:

// Enable the plugin
enablePlugins(RiddlSbtPlugin)

// Specify riddlc options to run during compile
riddlcOptions := Seq(
  "--verbose",
  "from", "src/main/riddl/riddl.conf",
  "validate"
)

// Minimum riddlc version required
riddlcMinVersion := "1.0.0"

Usage

Once configured, RIDDL validation runs automatically with compile:

sbt compile

To run validation explicitly:

sbt riddlValidate

Configuration Options

riddlcOptions

Command-line arguments passed to riddlc:

riddlcOptions := Seq(
  "--verbose",
  "--show-times",
  "from", "path/to/config.conf",
  "validate"
)

riddlcMinVersion

Minimum riddlc version required for this project:

riddlcMinVersion := "1.0.0"

The plugin will fail if the installed riddlc is older than this version.

riddlcPath

Override the path to the riddlc executable:

riddlcPath := file("/usr/local/bin/riddlc")

By default, the plugin searches the PATH.

Example Project Setup

lazy val root = project
  .in(file("."))
  .enablePlugins(RiddlSbtPlugin)
  .settings(
    name := "my-riddl-project",
    riddlcOptions := Seq(
      "from", "src/main/riddl/model.conf",
      "validate"
    ),
    riddlcMinVersion := "1.0.0"
  )

With a configuration file at src/main/riddl/model.conf:

common {
  verbose = true
  show-times = true
}

validate {
  input-file = "MyModel.riddl"
}

Multi-Project Builds

For projects with multiple RIDDL models:

lazy val domainA = project
  .in(file("domain-a"))
  .enablePlugins(RiddlSbtPlugin)
  .settings(
    riddlcOptions := Seq(
      "validate", "src/main/riddl/DomainA.riddl"
    )
  )

lazy val domainB = project
  .in(file("domain-b"))
  .enablePlugins(RiddlSbtPlugin)
  .settings(
    riddlcOptions := Seq(
      "validate", "src/main/riddl/DomainB.riddl"
    )
  )

CI Integration

The sbt-riddl plugin works seamlessly with CI systems:

# GitHub Actions example
- name: Validate RIDDL models
  run: sbt compile

Troubleshooting

Plugin Not Found

Ensure you're using the correct Scala version for the plugin. The plugin is published for Scala 2.12 (sbt 1.x default).

riddlc Not Found

Either: 1. Install riddlc and add to PATH 2. Set riddlcPath explicitly in build.sbt

Version Mismatch

If you see version errors, update your riddlcMinVersion or upgrade your riddlc installation.

Next Steps