What is the advantage of the ‘src/main/java” convention?

Main benefit is in having the test directory as subdirectory of src with the same directory structure as the one in main:

  • Project-A
    • bin
    • lib
    • src
      • main
        • java
          • RootLevelPackageClass.java
        • resources
      • test
        • java
          • TestRootLevelPackageClass.java
        • resources

All package private methods of RootLevelPackageClass will be visible, i.e. testable from TestRootLevelPackageClass. Since the testing code is also source its place should be under src directory.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)