Avoid overriding the default directory structure

Maven follows the design philosophy Convention over Configuration. Without any configuration changes, Maven assumes the location of the source code is ${basedir}/src/main/java, the location of tests is ${basedir}/src/test/java, and the resources are available at ${basedir}/src/main/resources. After a successful build, Maven knows where to place the compiled classes (${basedir}/target/classes) and where to copy the final artifact (${basedir}/target/). It is possible to change this directory structure, but it's recommended not to do so. Why?

Keeping the default structure improves the readability of the project. Even a fresh developer knows where to look, if he is familiar with Maven. Also, if you have ...

Get Maven Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.