Java › Build Tools: Maven & Gradle
What is the standard Maven directory layout, and why does following this convention matter?
BeginnerAnswer
Maven's convention-over-configuration philosophy defines a standard project structure: src/main/java for application source code, src/main/resources for non-code resources bundled into the artifact, src/test/java and src/test/resources for the equivalent test-scoped files, and target/ for build output -- following this convention means Maven's built-in plugins work correctly with zero explicit configuration, whereas deviating from it requires manually reconfiguring source directories in the pom.xml, adding unnecessary complexity for little benefit in most projects.
my-project/
src/
main/
java/ <- application source code
resources/ <- config files, bundled into the JAR
test/
java/ <- test source code
resources/ <- test-only config files
target/ <- compiled classes and packaged JAR go here
pom.xmlReal-world example A new team member familiar with Maven conventions can immediately navigate any Maven-based project's source layout without reading any project-specific documentation, since src/main/java, src/test/java, and pom.xml are universally consistent across virtually all Maven projects.