Jigsaw questions

Oleg Tsal-Tsalko oleg.tsalko at gmail.com
Thu Jul 13 07:34:53 UTC 2017


Dear experts,

I'm from JUG UA and currently playing with new Java 9 Module System using
Early Access Jigsaw build #174. As an exercise I'm modularising JUnit 5. In
process I faced couple of issues and have couple of questions to you:

   1. *How to compile test classes that are packaged in same packages as
   production code? *When I'm trying to compile test sources separately
   from application sources that have been already modularised (packaged in
   modules) I'm getting errors saying that particular packages already found
   in certain modules on module path. What are recommendations (best practice)
   here?
   2. When I'm trying to run unit tests placed on classpath using
   modularised JUnit5 library put on module path I'm getting errors
like "*Could
   not load class with
   name: org.junit.platform.commons.util.CollectionUtilsTests*". I have
   deduced that it is because CollectionUtilsTests class lives in same
   package as already exists in junit.platform.commons module placed on
   module path. If I run org.junit.mytests.SimpleTest from custom unique
   package instead everything works fine. My question is more general here
   though: *how to deal (access via reflection for example) with classes on
   classpath that use same packages as certain modules on module path?* We
   can't (it will be very difficult and inconvenient) ensure that no library
   on classpath uses same package as some of the modules on module path...

Could you please clarify these aspects to me please or point me where I can
read about it?

Thank you,
Oleg


More information about the jigsaw-dev mailing list