← All notes

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

Sources

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

Permanent ID: iil:note:fzfykshr

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.},
}

Markdown

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.