On 07/21/2016 10:55 AM, Alan Bateman wrote:
On 21/07/2016 09:14, Peter Levart wrote:
Also,
While it is expected that qualified exports are mostly used among
modules that are more tightly coupled and are therefore more likely
compiled together, some tools that invoke compiler (for example
Maven), have a strategy to compile one module at a time,
incrementally building the artifacts as the dependency tree instructs
(because they must insert other building steps before or after
compilation of each module, such as generating sources, etc...).
So we have a problem here if such tool wants to 1st compile module A
alone and then compile B which has a "requires" dependency on A,
because A also has a qualified "export" dependency on B. An option
like below could enable such separate compilation.
Single module compilation should be fine, assuming the source to the
referenced module is found (-modulesourcepath). We have exactly this
with the JDK build where modules are compiled in reverse topology
order. However, fair point about Maven projects, as qualified exports
are going to be problematic if they are separate projects as opposed
to a multi-module project.
They don't even have to be separate projects and you already have a
problem when you step into the directory representing the module "A"
and invoke mvn compile. In this case you are building just module A as a
separate project. So each maven multi-module project is also a set of
subsets of its modules and each such subset can be compiled in isolation...
The question is also should Maven then list module B as a dependency of
A in A's pom.xml ? How can it otherwise find out the name of B's
artifact? Jigsaw module names are not Maven artifact names and Maven
does not allow circular dependencies!
Regards, Peter
-Alan