user2304483
user2304483

Reputation: 1644

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)?

Upvotes: 0

Views: 533

Answers (1)

Gregor Zurowski
Gregor Zurowski

Reputation: 2346

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.

Upvotes: 5

Related Questions