javac --module-source-path and --patch-module do not work together

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed Nov 2 15:15:38 UTC 2016


Remi,

Your command line is questionable for putting output/modules on both -d 
and --module-path.   You don't need it on --module-path. When compiling 
modules, javac will automatically look in the output directory for 
classes for the module(s) being compiled.

Does your module source path contain source code for java.base? If so, 
it will only use that definition of java.base, and not anything in the 
paths given with --patch-module.

-- Jon


On 11/2/16 7:14 AM, Remi Forax wrote:
> Hi Jon, hi all,
>
> When i try to compile a module with --module-source-path that uses a patched class (with --patch-module),
> it fails.
>
> With:
> javac --module-source-path src \
>        -d output/modules/ \
>        --patch-module java.base=output/classes \
>        --module-path output/modules \
>        $(find src/org.hibernate.jpa/ -name "*.java")
>
> it seems that javac tries to find the source of the patched module (here java.base) in the module-source-path,
> so it get this error
>
> error: cannot find module: java.base
> 1 error
>
> I believe this is a bug.
>
> Step to reproduce it:
> git clone git at github.com:forax/access-broker.git
> and uncomment the lines that uses --module-source-path and --patch-module java.base=output/classes in the build.sh.
>
> regards,
> Rémi



More information about the jigsaw-dev mailing list