I’ve noticed that a lot of projects have the following structure:
- Project-A
- bin
- lib
- src
- main
- java
- RootLevelPackageClass.java
- java
- main
I currently use the following convention (as my projects are 100% java):
- Project-A
- bin
- lib
- src
- RootLevelPackageClass.java
I’m not currently using Maven but am wondering if this is a Maven convention or not or if there is another reason. Can someone explain why the first version is so popular these days and if I should adopt this new convention or not?
Main benefit is in having the
testdirectory as subdirectory ofsrcwith the same directory structure as the one inmain:All package private methods of
RootLevelPackageClasswill be visible, i.e. testable fromTestRootLevelPackageClass. Since the testing code is also source its place should be undersrcdirectory.