Using dynamic versions and changing modules

In Chapter 1, Defining Dependencies, we already learned about dynamic versions. For example, we can use a range of versions such as [4.0.1.RELEASE,4.0.4.RELEASE[. When the dependency is resolved by Gradle, the latest available static version in the range is selected.

A changing module is different than a dynamic version. A changing module references a dependency with the same version but with changing artifacts. For example, in a Maven repository, a changing module is the snapshot module indicated by -SNAPSHOT in the version attribute. Gradle can resolve a changing module dependency and get the latest artifact for the given version. However, the next time, a new artifact might be downloaded because the content has changed.

Gradle caches dynamic versions and changing modules for 24 hours. We will see how we can customize this behavior in our Gradle build file and from the command line. However, before we take a look at the options, we will first see how Gradle caching works.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.60.249