Provides experimental support for JEP 261: Module System, by using
the --module-path
and related settings when compiling and executing tests/code from sub projects with
this plugin enabled.
- Still under development, bugs are likely, and API will change.
- Compiling module-info.java files in SBT is not supported until sbt/zinc#522 is included in a release
- Forked mode is required
scalac
support for for JPMS is still pending (but will be integrated here once available)
// project/plugins.sbt
addSbtPlugin("com.lightbend.sbt" % "sbt-jpms" % "0.1.0")
val foo = project.enablePlugins(JpmsPlugin)
Compile
and Test
scopes use the same module name. This allows "whitebox testing", where
tests can access non-exported packages. The plugin will add --patch-module
, --add-reads
and --add-modules
as needed to make this work.
jpmsModuleName := Some("acme.foo")
jpmsModuleName in Compile := Some("amce.foo")
jpmsModuleName in Compile := Some("amce.foo.tests")
Or
jpmsModuleName in Compile := Some("amce.foo")
jpmsModuleName in Compile := None // Will consume the module on the classpath
val junitJupiterApiDep = "org.junit.jupiter" % "junit-jupiter-api" % jupiterVersion % Test jpmsName "org.junit.jupiter.api"
This project is maintained by Jason Zaugg (Scala team, Lightbend, @retronym)
Yes, pull requests and opening issues is very welcome!
Please test your changes using sbt scripted
.
This plugin is released under the Apache 2.0 License