Monday, April 29, 2019

Gradle Goodness: Manage Dependency Versions With Dependency Constraints

From Maven builds, we know the dependencyManagement section in our POM file. In the section, we can describe dependencies with their version, and later in the dependencies section, we can refer to the dependency without the version. We can use dependency constraints in Gradle to do the same thing. A dependency constraint can be used to define the version or version range for a dependency defined in our scripts or a transitive dependency. Just like a dependency, the dependency constraint is defined for a configuration, so we can fine-tune the constraints to the correct configuration.

Using dependency constraints in a multi-project build allows us to define the dependency versions in the root build file and define project dependencies per project without a version. The version will then be used from the dependency constraint we defined in the root build file.



from DZone.com Feed http://bit.ly/2WbqTmp

No comments:

Post a Comment