Since my request is only about required modules, I'll solely focus on that.

The responsibility of a build tool is to provide the right set of modules as 
described in the module descriptor.
But this module descriptor doesn't specify where these modules are coming from, 
so the build tool should provide some metadata file to define that.

There's no discussion that such module descriptor is useful for the main 
sources.

For the test sources it is unclear.
One reason to not provide a module descriptor is because it will never be a 
requirement for other modules.
And what about its name, as it is actually a required module and at the same 
also the same module.

One reason to provide a module descriptor is for the build tool to know which 
modules are required, so it can provide the right set of modules.
But how would such descriptor for test sources look like? Well, in the end it 
must contain everything from the main module descriptor + the test requirements.
I assume that copy/pasting the main module descriptor for a new test module 
descriptor + adding the extra requirements is not the preferred solution.

Hence in case of compiling test sources Maven does it the other way around. 
It's metadata file already contains the modules required for testing, aka test 
scoped dependencies.
And with this Maven is capable to construct the right set of arguments to 
compile the test sources, giving proper --add-read arguments, etc.
But there's one small set of modules that is not defined in this metadata file: 
the java.* and jdk.* modules. (this in my only issue!)

In case of Maven, even if we could find a way to define these modules as 
dependencies, this won't simplify the usage of the modular system. 
Why does one need to define if for test sources and not main sources? For 
consistency we could ask users to add them for both main and test sources.
Any solution in the pom file is a workaround: in the end they are just a set of 
sources files that depend on modules and for that reason deserves a module 
descriptor.
But due to its special purpose it should somehow be based on the main module 
descriptor.

Without it people will specify these test required java.*/jdk.* modules in the 
only place they know to specify any required modules: the main module 
descriptor.
Having a mixture here of required modules for both main and test to avoid 
compilation errors is something we should refuse.

regards,
Robert
On 25-2-2020 18:24:51, Alex Buckley <alex.buck...@oracle.com> wrote:
On 2/25/2020 9:11 AM, Alex Buckley wrote:
> And there are other ways, where the build tools (or their plugins) take
> responsibility for arranging the test-time module graph. This may
> require more work on the part of build tool/plugin maintainers than
> simply telling their users to write JDK command line options in the
> middle of a config file.

Roy knows what I mean:
https://twitter.com/royvanrijn/status/1232309684788432896

Reply via email to