As an example, say I have a program named Abc containing one class named Xyz. The code is located in a Git repository containing a single Eclipse project. I've adopted the Maven source directory layout. Before Java 9 the project structure might have looked like this (simplified):
Abc.git
|
+---.git
|
+---Abc
|
+---.settings
|
+---.project
|
+---.classpath
|
+---src
|
+---main
| |
| +---java (source folder)
| |
| +---com
| |
| +---abc
| |
| +---Xyz.java
+---test
|
+---java (source folder)
|
+---com
|
+---abc
|
+---XyzTest.java
The JUnit tests were typically in the same packages as the production code, but in a different source folder. But now the production code is in a module. A package being tested can't be split into separate modules. Furthermore, some classes under test may reside in packages not exported by their module.
What is the correct practice in terms of code organization to address these issues?
This question is not about Maven. What I meant was: Is this the recommended way to do it?
Abc.git
|
+---.git
|
+---Abc
|
+---.settings
|
+---.project
|
+---.classpath
|
+---src
|
+---main
| |
| +---java
| |
| +---com.abc (source folder?)
| |
| +---module-info.java (exports com.abc)
| |
| +---com
| |
| +---abc
| |
| +---Xyz.java
+---test
|
+---java
|
What goes here?