cuba-platform / documentation

CUBA Platform Documentation
https://www.cuba-platform.com
Creative Commons Attribution 4.0 International
25 stars 45 forks source link

Guide about fix the incorrect dependency resolution #712

Closed soraksh closed 4 years ago

soraksh commented 4 years ago

Environment

Description of the enhancement

See cuba-gradle-plugin#23. There is a problem when you want to use platform of snapshot version, but at the same time using app component with some release platform version. Release version will get into the assembled project. It was decided to give users simple guide to solve problems like that on their project level.

Text of the guide:

In some cases, you want to use a specific version of some library in the project, but another gets into the project from the dependency tree. For example, a newer version or release version when you want a snapshot version. Let's look at an example when you add the CUBA platform version X.Y-SNAPSHOT to a project, while using an application component that uses a platform version X.Y.1. Assembled project will use a platform version X.Y.1. To solve this problem, you can use the standard Gradle tools like affecting configurations via ResolutionStrategy. For instance, add next code to the build.gradle project file:

allprojects {
    configurations {
        all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.haulmont.cuba') {
                    details.useVersion 'X.Y-SNAPSHOT'
                }
            }
        }
    }
}

In this code block we add a rule according to which version X.Y-SNAPSHOT will be used for all dependencies of group com.haulmont.cuba.