RFR: JDK-8261518: jpackage looks for main module in current dir when there is no module-path [v2]

Alexey Semenyuk asemenyuk at openjdk.java.net
Wed Mar 3 21:41:41 UTC 2021


On Wed, 3 Mar 2021 13:56:01 GMT, Andy Herrick <herrick at openjdk.org> wrote:

>> test/jdk/tools/jpackage/share/jdk/jpackage/tests/NoMPathRuntimeTest.java line 125:
>> 
>>> 123:                 .addArguments("-cvf", "junk.jar",
>>> 124:                         "-C", tmpdir.toString(), "Hello.class")
>>> 125:                 .execute();
>> 
>> Single line `HelloApp.createBundle("junk.jar:Hello", tmpdir);` would compile source class and put it into "junk.jar" in `tmpdir` folder. It can be used to replace lines from [109, 125] range.
>> 
>> What is the point to build "junk.jar"? I don't see how it is used in the test.
>
> The bug is that when --module-path option is not used in a modular app, jpackage uses a module-path with "." on it.
> Having a non-modular jar in the modular path is an error.
> So with this non-modular Hello.jar in the current directory the jpackage command failed before the fix, and succeeds after the fix.
> 
> I can create the non-modular Hello.jar in the current directory with one line:
> HelloApp.createBundle(JavaAppDesc.parse("junk.jar:Hello"), Path.of("."))

Another precondition for the test is that Java runtime used with jpackage command should include module with app main class, right?
Test arguments are: `List.of("Hello", "com.foo/com.foo.main.Aloha");`. The first argument is non-modular app, it is not used with jlink. What is the point to run the test for non-modular app?

-------------

PR: https://git.openjdk.java.net/jdk/pull/2781


More information about the core-libs-dev mailing list