spring-bootmavenspring-initializr

Why spring.io generate pom without version?


I'm new to springboot and using spring.io to create project in order to create microservices.

When creating a project using spring.io website, a pom is created with all the relevant dependencies but versions are not added. Should I add the versions myself looking the maven repository jar (all jars include versions on them)?


Solution

  • All dependencies (and configurations) are managed by Spring Boot. The parent of the project you generated with Spring Initializr has the parent set to spring-boot-starter-parent:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    

    The parent of spring-boot-starter-parent is spring-boot-dependencies which defines all dependency versions.

    Therefore you don't need to specify any versions of the starter dependencies or their dependencies manually.

    Please take a look at The Spring Boot Starter Parent on Baeldung for a quick overview.