Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7901988

Module testng not found when a non-module directory exists

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • None
    • tools
    • None

      I ran into this trying to create a TestNG test as a module.

      mkdir -p m/p

      cat > Driver.java << EOF
      /**
       * @test
       * @build m/*
       * @run testng/othervm m/p.Tests
       */
      EOF

      cat > module.info.java << EOF
      module m {
          requires testng;
          exports p to testng;
      }
      EOF

      cat > p/Tests.java << EOF
      package p;
      import org.testng.annotations.Test;
      @Test
      public class Tests { }
      EOF

      The tests runs, no issues. Looking at the .jtr file, I see the boot layer is:

      Boot Layer
        add modules: m1 testng
        module path: /d/JTwork/tmp/Driver.d/modules
                     /d/JTwork/modules

      Now create a directory as a sibling to m, the directory can be empty. jtreg fails with:

        java.lang.module.FindException: Module testng not found, required by m1

      The jtr file this time is:

      Boot Layer
        add modules: m1
        module path: /d/JTwork/tmp/Driver.d/modules

      Note that testng has disappeared from the list of modules to add.

            Unassigned Unassigned
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: