A Maven repository is a storage location where build artifacts, such as jars, plugins, and their metadata, are kept so Maven can retrieve them by coordinate instead of requiring developers to manage jars manually.
Key Points: • The local repository lives on the developer's machine, by default at ~/.m2/repository, and caches everything already downloaded. • Remote repositories, such as Maven Central, host publicly available artifacts that Maven downloads on demand. • Internal or private repositories, like Nexus or Artifactory, let organizations host proprietary artifacts and proxy remote repositories. • Maven resolves a dependency by first checking the local repository, then falling back to configured remote repositories if it's missing. • Installing a project with mvn install publishes its artifact into the local repository for use by other local projects.
Example: When a project declares junit as a test dependency, Maven checks ~/.m2/repository first; if it isn't cached, Maven downloads it from Maven Central and stores it there for future builds.
Interview Tip: A concise interview answer is:
"A Maven repository is where build artifacts like jars and their POMs are stored and retrieved by coordinate. There's a local repository cache on disk, and remote repositories like Maven Central or a private Nexus server that Maven downloads from when an artifact isn't already cached locally."