Maven and pom.xml

Coordinates: groupId, artifactId, version

Every Maven project and every library is identified by three values called coordinates:

ElementMeaningShopEase
groupIdorganisation / reverse domaincom.shopease
artifactIdproject nameshopease
versionrelease version; -SNAPSHOT = still in development0.0.1-SNAPSHOT

A Complete Spring Boot pom.xml

pom.xml

This is what Spring Initializr generates for ShopEase (Web + DevTools + Test):

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <!-- inherit Spring Boot defaults: plugin config + versions of ~400 libraries -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.5.6</version>
        <relativePath/>
    </parent>

    <groupId>com.shopease</groupId>
    <artifactId>shopease</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>shopease</name>
    <description>ShopEase e-commerce backend</description>

    <properties>
        <java.version>21</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>   <!-- no <version>: the parent manages it -->
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- builds the executable "fat" jar and adds mvn spring-boot:run -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

Why the Parent Matters

spring-boot-starter-parent contains a bill of materials (BOM): a tested list of versions for Spring, Jackson, Tomcat, Hibernate, JUnit, MySQL driver and hundreds more. That is why you write dependencies without a version. When you upgrade Spring Boot (change 3.5.6), every managed library moves to a compatible version together.

Note: Avoid overriding managed versions unless you must (e.g. a security fix). Mixing random versions is the number one cause of NoSuchMethodError and ClassNotFoundException at startup.