On Wed, 3 Mar 2021 14:50:07 GMT, Andy Herrick <herr...@openjdk.org> wrote:

>> when the app modules have already been jlinked with the runtime, and there 
>> is no need for module-path, jpackage was acting as if the module-path was 
>> "." and picking up jars in the current directory.
>
> Andy Herrick has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   JDK-8261518: jpackage looks for main module in current dir when there is no 
> module-path

Changes requested by asemenyuk (Committer).

test/jdk/tools/jpackage/share/jdk/jpackage/tests/NoMPathRuntimeTest.java line 
105:

> 103: 
> 104:         // create a non-modular jar in the current directory
> 105:         HelloApp.createBundle(JavaAppDesc.parse("junk.jar:Hello"), 
> Path.of("."));

Test files must be created in test work directory (`TKit.workDir()`) and not in 
the current directory. Test harness creates empty work directory for every test 
run. In case of running this test multiple times and if previous test execution 
was aborted "junk.jar" will be in the current directory from the previous test 
run and the next test run will fail. 
Running test multiple times without running clean up is the case when the test 
is executed in IDE under debugger and debugging session is aborted.
If you absolutely must create "junk.jar" in the current directory, you need to 
remove it manually. Something like this:
Path junkJar = null;
try {
  junkJar = HelloApp.createBundle(JavaAppDesc.parse("junk.jar:Hello"), 
Path.of("."));
  ...
  cmd.executeAndAssertHelloAppImageCreated();
} finally {
    if (junkJar != null) {
      TKit.deleteIfExists(junkJar);
    }
}

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

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

Reply via email to