Cannot expose test class from one subproject to another

I’ve been trying to do what this answer says to expose some common test classes from subproject “:a:B” to “:a:C” but it fails to compile with NoClassDefFoundError.

I also tried this method but also failed:

I’m using gradle 7.2.

How can I consume those classes?

Hi @juankb1024
can you share a bit more about your project structure ?
What classes do you want to share between projects ?
are they some test fixtures that are written in project B, and you want them as well to write some of your tests in project C, or ?

eventually you’ll want (in project C) something like (snippet in groovy)

dependencies { testImplementation project(":B") } 

to have classes on the default configuration of project B available to the classpath used to compile tests of project C. But the exact syntax will depend on whether those classes are bundled in the default configuration of project B or not, hence the question about the setup of projects B and C