On 11/09/2017 01:05 PM, Till Brychcy wrote:
Am 09.11.2017 um 09:29 schrieb Alan Bateman <alan.bate...@oracle.com>:
Yes, --patch-module is needed to compile the tests "as if" they are part of the
module, e.g.
javac --module-path classes:junit.jar --patch-module m=src/test/java
--add-reads m=junit -d test-classes \
src/test/java/p1/P1Test.java
Thanks a lot, Alan!
The surprise for me was that --patch-module is used for source folders, too. I
thought it was only for binaries.
But I noted I also have to add "--add-modules=junit" or the "--add-reads
m=junit" will give an error that module junit cannot be found.
So the command has to be:
javac -d target/test-classes --patch-module m=src/test/java --module-path
target/classes:junit-4.8.2.jar --add-modules=junit --add-reads m=junit
src/test/java/p1/P1Test.java
I’m not sure if that is a bug or a feature. BTW, I noted that "javac -help"
doesn’t mention --patch-module and --add-reads at all (only --add-modules)
Use "javac -X" or "javac --help-extra" to see help on additional
options, such as less common or more advanced options.
-- Jon