scala-maven-plugin
Introduction: The scala-maven-plugin (previously maven-scala-plugin) is used for compiling/testing/running/documenting scala code in maven.
Tags:
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 setscala.homeproperty insrc/it/test_scalaHome/pom.xmlto correspond to your environment. See Build section above for a simple setup.
- note: to run
./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 withgh workflow run release.yaml -R davidB/scala-maven-pluginreleaseVersion(optional): version to release, defaults to the current version without-SNAPSHOTdevelopmentVersion(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
releaseenvironment: a required reviewer must approve it before it starts release:prepareruns 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 tomasterrelease:performbuilds 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
releaseenvironment:CENTRAL_USERNAME/CENTRAL_PASSWORD(Central Portal user token),GPG_PRIVATE_KEYand optionallyGPG_PASSPHRASE - after the release, pull
masterbefore pushing anything, since the workflow pushed two commits to it
TODO
- close issues from https://github.com/davidB/scala-maven-plugin/issues/
- refactor :
- reduce copy-paste
- file path management can be improved (a lot)
- clean the code
