What are Maven coordinates (GAV), and what does each part identify?
answer
- groupId = reverse-DNS namespace
- artifactId = project name
- version = release id
- GAV → repo path
- packaging + classifier optional
basics
~10 sGAV stands for groupId, artifactId, version. Together they uniquely identify an artifact in a Maven repository. groupId is the owning org/namespace, artifactId is the project name, version is the release.
solid answer
~40 sMaven coordinates uniquely address an artifact. The core triple is groupId (a reverse-DNS namespace for the owning org/team, e.g. org.springframework), artifactId (the specific module name, e.g. spring-core), and version (e.g. 5.3.30). Together GAV forms the address Maven uses to store, resolve, and download the artifact from a repository, mapping to a path like org/springframework/spring-core/5.3.30/. Two optional coordinates extend this: packaging (defaults to jar, decides the build lifecycle and output type) and classifier (a suffix to ship secondary artifacts like sources or javadoc alongside the main one). When you declare a dependency you give at least GAV; Maven uses it both to find your project's own output and to locate dependencies transitively.
code
xml · 5 lines<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
</dependency>go deeper
Recall that GAV = groupId, artifactId, version and that it uniquely identifies an artifact.
Explain how GAV maps to the repository path and filename, plus the optional packaging/classifier coordinates.
Discuss naming conventions, namespace ownership, and how GAV drives transitive resolution and conflict mediation.
Govern org-wide groupId conventions, artifact naming standards, and how coordinate hygiene affects monorepo/multi-team artifact discoverability.
## What are Maven coordinates? Maven is a build tool that stores every built artifact (a JAR, WAR, etc.) in a **repository** — a structured directory tree (your local `~/.m2/repository`, plus remote ones like Maven Central). To find any artifact unambiguously, Maven gives each one an address called its **coordinates**, commonly abbreviated **GAV**. ## The three core coordinates - **groupId** — a namespace identifying the organization or team that owns the artifact. By convention it uses reverse-DNS, e.g. `org.apache.commons`. This avoids name clashes between different vendors. - **artifactId** — the name of the specific project/module within that group, e.g. `commons-lang3`. Must be unique within the group. - **version** — the release identity, e.g. `3.14.0`. Distinguishes builds of the same project over time. ## How coordinates map to a path Maven turns GAV into a repository path by replacing dots in groupId with slashes: ``` org/apache/commons/commons-lang3/3.14.0/commons-lang3-3.14.0.jar ``` The filename is `<artifactId>-<version>[-<classifier>].<extension>`. ## Two optional coordinates - **packaging** (`<packaging>`) — defaults to `jar`. It selects the build lifecycle bindings and the output type (jar, war, pom, etc.). - **classifier** (`<classifier>`) — an optional suffix that lets one GAV ship multiple artifacts, e.g. `sources`, `javadoc`, or a platform-specific build. ## In a pom.xml ```xml <project> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>billing-service</artifactId> <version>1.4.2</version> <packaging>jar</packaging> </project> ``` The same triple appears when you depend on something: ```xml <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.14.0</version> </dependency> ``` Maven uses GAV both to publish your project's output and to resolve every dependency (and their transitive dependencies) from repositories.
- Why is reverse-DNS used for groupId?To guarantee global uniqueness across vendors — you own example.com, so com.example won't clash with anyone else's namespace.
- What is the minimum needed to declare a dependency?groupId, artifactId, and a version (the version can be omitted if managed via dependencyManagement or a BOM).
GAV is like a postal address: groupId is the city/zone, artifactId is the street, version is the house number — together they point to exactly one place.
saying these in an interview costs you the question
- Saying groupId and artifactId are interchangeable
- Claiming version is optional in all cases (it's required unless managed)
- Thinking coordinates are just labels and not the actual lookup key in the repository