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.
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.