Combining --add-modules ALL-MODULE-PATH with --module-source-path

Nicolai Parlog nipa at codefx.org
Sat Jan 21 09:46:54 UTC 2017


 Hi!

I just realized that the result with `--add-modules ALL-MODULE-PATH` is
_not_ the same as without. I accidentally tried it when the class files
were already present in `classes`, which led to no compilation and hence
no message.

With `classes` being empty I get this instead:

error: --add-modules ALL-MODULE-PATH can only be used when compiling the
unnamed module
error: --add-modules ALL-MODULE-PATH can only be used when compiling the
unnamed module
error: --add-modules ALL-MODULE-PATH can only be used when compiling the
unnamed module
error: cannot access module-info
  cannot resolve modules
error: cannot access module-info
  cannot resolve modules
5 errors

It seems a little weird that a faulty command does not create an error
but that may be be design because no compilation has to happen.

 so long ... Nicolai



On 21.01.2017 10:34, Nicolai Parlog wrote:
>  Hi!
> 
> I have been experimenting with the the module source path and
> multi-module compilation and must say that it is really cool. I like how
> it operates on a higher level of abstraction.
> 
> With a small application where the initial module transitively requires
> all others this is very nice:
> 
> javac
> 	--module-path mods
> 	--module-source-path "./*/src/main/java"
> 	-d classes
> 	-module initial.module
> 
> As soon as services show up, this does not work as smoothly anymore
> because the initial module does not depend on the service providers so
> they do not get compiled. That was expected.
> 
> But to my surprise, using --add-modules ALL-MODULE-PATH does not change
> that. The following command has exactly the same result as above
> regarding service providing modules that the initial module does not
> transitively depend on:
> 
> javac
> 	--module-path mods
> 	--module-source-path "./*/src/main/java"
> 	--add-modules ALL-MODULE-PATH
> 	-d classes
> 	-module initial.module
> 
> Assuming I made no mistake, I find this a little odd. Is there a reason
> behind this that I don't see or is it an unimplemented feature? If the
> latter, I think it would be really nice to have it implemented in the
> interest of fidelity across phases. Launching the same application would
> look like this:
> 
> java
> 	--module-path mods
> 	--add-modules ALL-MODULE-PATH
> 	-module initial.module
> 
> And isn't that eerily similar. :)
> 
>  so long ... Nicolai
> 
> 
> 

-- 

PGP Key:
    http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509

Web:
    http://codefx.org
        a blog about software development
    https://www.sitepoint.com/java
        high-quality Java/JVM content
    http://do-foss.de
        Free and Open Source Software for the City of Dortmund

Twitter:
    https://twitter.com/nipafx


More information about the jigsaw-dev mailing list