scala-maven-plugin

Introduction: The scala-maven-plugin (previously maven-scala-plugin) is used for compiling/testing/running/documenting scala code in maven.
More: Author   ReportBugs   OfficialWebsite   
Tags:

ci Maven Central

The scala-maven-plugin (previously maven-scala-plugin) is used for compiling/testing/running/documenting Scala code in Maven.

Similar plugins

Build

You need JDK 17 or later to build the plugin, create the site, and run integration-test (CI uses JDK 24); use the Maven wrapper (./mvnw). The plugin itself is compiled for Java 8 (maven.compiler.release=8).

Commands

  • ./mvnw package : generate jar
  • ./mvnw site : generate the plugin website
  • ./mvnw integration-test : ./mvnw package + run all integration test
    • note: to run test_scalaHome: you have to set scala.home property in src/it/test_scalaHome/pom.xml to correspond to your environment. See Build section above for a simple setup.
  • ./mvnw integration-test -Dinvoker.test=test1 : run integration test 'test1' (against all configuration) useful for tuning/debug
  • ./mvnw install : ./mvnw integration-test` + publish on local maven repository
  • ./mvnw install -Dmaven.test.skip=true : ./mvnw install` without run of unit test and run of integration test

Release

Releases are published to Maven Central by the release GitHub Actions workflow, which is triggered manually. Don't push a release tag yourself: the workflow creates it.

  • start it from the Actions tab ("release" → "Run workflow", on master), or with gh workflow run release.yaml -R davidB/scala-maven-plugin
    • releaseVersion (optional): version to release, defaults to the current version without -SNAPSHOT
    • developmentVersion (optional): next development version, defaults to the next patch -SNAPSHOT
    • e.g. gh workflow run release.yaml -R davidB/scala-maven-plugin -f releaseVersion=4.11.0 -f developmentVersion=4.11.1-SNAPSHOT
  • the job runs in the release environment: a required reviewer must approve it before it starts
  • release:prepare runs the tests and integration tests, commits the release version, tags it (tag is the bare version, e.g. 4.10.1), commits the next development version and pushes to master
  • release:perform builds the tag, signs the artifacts with a dedicated release key (BouncyCastle signer, no local gpg needed) and publishes them to Maven Central
  • secrets of the release environment: CENTRAL_USERNAME / CENTRAL_PASSWORD (Central Portal user token), GPG_PRIVATE_KEY and optionally GPG_PASSPHRASE
  • after the release, pull master before pushing anything, since the workflow pushed two commits to it

TODO

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools
AI Daily Digest