How-to use the platform to streamline modelix dependencies

General Usage

The modelix platform provides component versions. To enforce these versions in your project’s build you can add the platform as an enforcedPlatform. We make the following assumptions:

  • the string variable mps_version contains the mps version that is used in your project, e.g. 2021-1

  • the string variable modelix_platform_version contains the version of the modelix platform you want to use, e. g. 23.1.0

To enforce the versions provided by the platform in your Gradle build, you can use enforcedPlatform inside of a dependencies block like this:

dependencies {
    implementation(enforcedPlatform("org.modelix:platform-mps-$mps_version:$modelix_platform_version"))
}

Dependencies to modelix components can then be declared without a version number (as the version declared in the platform will be used). For example:

dependencies {
    implementation(enforcedPlatform("org.modelix:platform-mps-$mps_version:$modelix_platform_version"))
    implementation("org.modelix:model-client")
}
If you want to handle dependencies to MPS version-specific modelix components yourself, you can use org.modelix:platform instead, which does not contain these dependencies. However, sometimes it might be necessary to pick a specific version of a single component, e.g. when one wants to test new features.

Overriding versions

Overriding versions may lead to incompatibilities between individual modelix components.

In order to override versions inside the platform during dependency resolution, platform can be used instead of enforcedPlatform:

dependencies {
    implementation(platform("org.modelix:platform-mps-$mps_version:$modelix_platform_version"))
    implementation("org.modelix:model-client:2.4.0")
}
If you want to learn more about the difference between platform and enforcedPlatform, you can check out this section in the Gradle documentation.