Module fragments and deployment scope
Ali Ebrahimi
ali.ebrahimi1781 at gmail.com
Mon Mar 28 13:49:45 UTC 2016
If you followed jigsaw-dev list you noticed some difficulties raised when
testing java9 modules. For reference you can follow jigsaw-dev.
I have one suggestion for this and that is Module fragments. If you
familiar with OSGI fragments, module fragments is attached to (or embeded
in) main (host) module.
So we can implements test source code as module fragments that can have its
own additional dependencies.
module-fragment-info.java
fragment com.foo.test for com.foo{
requires org.junit;
}
Even we can add module deployment scope (or type) or runtime mode and
fragments can be enabled or disabled based on module system running mode.
module-fragment-info.java
fragment com.foo.test for com.foo{
requires org.junit;
deployment-scope: test
}
So fragment com.foo.test would be enabled when module system running in
test mode.
I think module fragments can have other use cases, such as when we have one
big module that should have support multiple OSs or Archs. Each OS or Arch
can have its own specific code (and native).
--
Best Regards,
Ali Ebrahimi
More information about the jpms-spec-comments
mailing list