How to declare a version in a Gradle platform project and reuse it in other projects?

I have a Gradle platform project, let it be (common-dependencies) that acts as a BOM, where I declare and manage versions of dependencies for my microservices and libraries. Here’s an example of build.gradle there:

dependencies {
    constraints {
        api 'com.example.lib:core-lib:1.2.3'
        api 'com.example.lib:style-config:0.4.5'
    }
}

In my core-lib project, I include this BOM as a platform:

dependencies {
    implementation(platform("com.example:common-dependencies:${platformVersion}"))
}

What I want to achieve is this:
I want to declare the version of com.example.lib:core-lib in a single place in common-dependencies and automatically use that version as the project.version in the core-lib project. This would ensure that the version of the core-lib artifact used in other microservices is always consistent with the version used to build the core-lib artifact itself.