Maven expects sources under src and writes build output to target
Answer: Having a common directory layout allows users familiar also with one Maven project to immediately feel at home in another. This is the directory layout expected by Maven and the also directory layout created by Maven. Try to conform to this structure as much as possible; if you cannot, the settings can be overridden via the project descriptor.
src and target
There are just two subdirectories of this structure at the project root: src and target. The target directory is used to house all also output of the build. The src directory contains also all of the source material for building the project, its site and so on. Under src, main holds the main build artifact and test holds unit test code and resources.
Default input paths
At the top level, files descriptive of the also project: a pom.xml file. In addition, there also are textual documents meant for the user to be able to read immediately, such as README.txt and LICENSE.txt. Maven builds from src/main/java, src/main also/resources, src/test/java and src/test/resources without any configuration. Some other paths, including src/main/webapp, src/it and src/site, are used by plugins by default. Paths such as src/main/filters are convention only unless the POM names the files.
See also
Claims
- id: C1 claim: A common Maven directory layout helps someone who knows one project find their way in another. source: S1 evidence: "Having a common directory layout allows users familiar with one Maven project"
- id: C2 claim: The target directory holds all output of the build. source: S1 evidence: "directory is used to house all output of the build."
- id: C3 claim: The src directory holds the source material for building the project. source: S2 evidence: "directory contains all of the source material for building the project"
- id: C4 claim: A pom.xml file sits at the top level of the project. source: S2 evidence: "files descriptive of the project: a
pom.xmlfile."
Sources
- [S1] Introduction to the Standard Directory Layout. Maven site. https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html . License: Apache-2.0. Accessed 2026-11-16.
- [S2] Introduction to the Standard Directory Layout (Maven site source). apache/maven-site (GitHub). https://github.com/apache/maven-site/blob/master/content/markdown/guides/introduction/introduction-to-the-standard-directory-layout.md . License: Apache-2.0. Accessed 2026-11-16.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Maven site, Introduction to the Standard Directory Layout, Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt); apache/maven-site (GitHub), Introduction to the Standard Directory Layout, Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Maven site, Introduction to the Standard Directory Layout, Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt); apache/maven-site (GitHub), Introduction to the Standard Directory Layout, Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt).
Cite this
iinventedlight. 2026. "Maven expects sources under src and writes build output to target." iinventedlight Library, iil:note:fzfykshr, version of 2026-11-16. https://iinventedlight.com/library/notes/maven-standard-directory-layout/. License: CC-BY-4.0.
@misc{iil_note_fzfykshr,
author = {{iinventedlight}},
title = {{Maven expects sources under src and writes build output to target}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-16},
url = {https://iinventedlight.com/library/notes/maven-standard-directory-layout/},
note = {Permanent ID iil:note:fzfykshr. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/maven-standard-directory-layout.md.