modulepath and classpath mixture

Alan Bateman Alan.Bateman at oracle.com
Wed Mar 23 07:21:46 UTC 2016


On 22/03/2016 22:20, Russell Gold wrote:
> I’d like to take a step back here. It may be that I have completely misunderstood what is going on, but this all seems to have gotten way more complicated than it should.
>
> I am assuming:
>
> 1) the project has both module and class path compile dependencies, and possibly has both module and class path test dependencies as well.
> 2) the artifact type “module” (or something similar) is now recognized as indicating a Jigsaw module (which needs to go on the module path)
> 3) the classes being built may be put into their own module, but might not be.
>
> Then there are really four categories of dependencies. The compile step needs to place its jar dependencies on the class path and its module dependencies on the module path. I presume that is what Robert is already doing.
> The test-compile step needs to handle all four, including the compiled class in its test class path.
>
> Then there is no need to compile either the main or test classes as part of a module. They may use modules, but that is a different matter. No need for the -Xmodule switch at all. The only reference to module is as dependencies.
>
> Did I completely miss the point?
>
It depends on where the tests live. If they are black box tests that 
only exercise the API (the public types in the module's exported 
packages) then they can live anywhere. If they are in the same class 
loader and package as the code they are testing (the norm in Maven) then 
they need to compiled as if they are part of the module. We might think 
of these as white box tests as they can make use of public types in 
packages that aren't exported, maybe they are using package-private 
types/methods too.

-Alan


More information about the jigsaw-dev mailing list