I'm trying to implement the following structure in my module. It's a gradle project.
./src/main/java/mypackage
./src/test/java/mypackage
./src/testfx/java/mypackage --I want to add this!
I'd like all the test files to be in the same package as the source. We keep methods/variables package private to make testing easier. This is how it is in the existing test package. If I don't mark the testfx directory as a test root then Intellij won't index it (yes I tried invalidating caches). If I do mark it as a test root then Intellij wants the package name for my test files under testfx to be "java.mypackage". I want it to be "mypackage". Is there a way to do this?
You want to add a directory to your test
source set. In your build file:
// Groovy DSL
java.sourceSets.test.java.srcDirs('src/testfx/java')
// Kotlin DSL, shortening further per @Slaw comment
java.sourceSets.test { java.srcDirs("src/testfx/java") }