

If anyone else is still wondering about this, I do recommend following advice and referencing junit's project structure. Lots of thanks to the people who parsed this question through with me! My final directory structure looks like this: wit-core/ When the binary is invoked, it starts the application by. This fits the way I decided to architect the application by having two separate Gradle sub-projects, each of them having their own src/main/java directory. I have a QT application that runs both in interactive mode wit GUI and in Batch mode without GUI. They should be in a separate directory but the same package name as their test subjects (so that they're not blocked from accessing package private methods). They should have access to every class in the module so it makes sense that they be part of the module.


Your second question is much easier: unit test classes should be in the same module as their test subjects. Otherwise you could have different modules under a single source but you'd be fighting against Eclipse's/Intellij's module support (but it is possible). If you plan on having different teams maintaining their own modules, then you'll have to have seperate roots and you would use their modules just like a 3rd party library with module dependencies through a jar or jmod file. But Java editors like Intellij and Eclipse kind of force you into having separate source roots for each module. They support either types of directory structures. To Nick Maiorano and received this response:įor your first question, the Java compiler and runtime have no opinion on this. I'm mostly wondering about the directory structure of all of this. I'm using gradle and the jlink plugin and have an application that I want to split into two modules, are the modules supposed to be under the src/main/java directory or should it be refactored to src/mod1/ and src/mod2? Another question that comes from this is testing and where to place junit test classes.
