Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-2313

Module ${related.module.name} not found for JUnit test

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 11.0
    • None
    • java - JUnit
    • None
    • Product: Apache NetBeans IDE 11.0 (Build incubator-netbeans-release-404-on-20190319)
      Java: OpenJDK 64-Bit Server VM 12+33
      System: Linux version 4.15.0-46-generic running on amd64

    Description

      When I try to run a JUnit 4.12 test case in a non-modular project, I get the following error:

      Error occurred during initialization of boot layer
      java.lang.module.FindException: Module ${related.module.name} not found
      

      The full output with the Ant Verbosity Level set to Verbose is attached below.

      I worked around the issue by making the following two changes.

      First, I changed the project's Run-time Test Libraries under Project Properties > Libraries > Run Tests as follows:

      Before (default, fails)

      Modulepath
          Modulepath for Compiling Tests
      Classpath
          Classpath for Compiling Tests
          Compiled Tests
      

      After (works)

      Modulepath
      Classpath
          Modulepath for Compiling Tests
          Classpath for Compiling Tests
          Compiled Tests
      

      Then I also created a new Run Configuration called "Tests" which did not contain the VM Option "--add-modules=javafx.graphics".

      With the "Tests" run configuration selected in the NetBeans toolbar, and the change to the Run Tests Libraries, the unit tests ran without errors.

      Attachments

        1. related-module-name.log
          15 kB
          John Neffenger

        Activity

          People

            Unassigned Unassigned
            jgneff John Neffenger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: