There are 2 ways to manage versions in multi-project solutions, e.g. Java project with microservices:
Dependency management
In parent pom.xml you define a long list of depencies used across child projects
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
</dependencyManagement>
and in child pom.xml you just don't specify versions
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
Version placeholders
In parent pom.xml you define properties like
<properties>
<driver.version>4.9.0-scylla-1</driver.version>
<spring-boot.version>3.0.1</spring-boot.version>
<spring-cloud.version>2022.0</spring-cloud.version>
<lombok.version>1.18.24</lombok.version>
</properties>
then in child pom.xml you must specify version in a way
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>${spring-boot.version}</version>
</dependency>
Which is the preferred way to keep dependency versions consistent in a microservice environment? What are pros and cons of these two ways? The second way seems more elastic because each of child projects may select other version of dependency and you may build project with another version of some dependency from commandline.