# How do I always use the latest version of a changing module

**URL:** <https://discuss.gradle.org/t/how-do-i-always-use-the-latest-version-of-a-changing-module/5314>\
**Category:** Old Forum Archive\
**Created:** [November 10, 2011, 10:05am UTC](https://discuss.gradle.org/t/how-do-i-always-use-the-latest-version-of-a-changing-module/5314 "2011-11-10T10:05:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vpranavkumar1](https://avatars.discourse-cdn.com/v4/letter/v/977dab/32.png) [@vpranavkumar1](https://discuss.gradle.org/u/vpranavkumar1)\
**Post date:** [November 10, 2011, 10:05am UTC](https://discuss.gradle.org/t/how-do-i-always-use-the-latest-version-of-a-changing-module/5314/1 "2011-11-10T10:05:00Z")

</div>

Hi,

Lets say my module is dependent on artifact ‘A.jar’ with version ‘1.0’. I run my build script, the artifact is downloaded from binary repository and is cached on my machine. If someone updated the same artifact ‘A.jar’ and uploaded it with same version ‘1.0’ in the binary repository. Running build script again does not download the latest artifact. It seems once the artifact for a given version is cached locally build scripts do not try to download it again.

Shouldn’t there be some check (may be based on timestamp and md5sum) if the cached artifact and that available in binary repository are same or not and if different download the latest one.

Regards, Pranav

---

<div class="post-metadata">

**Author:** ![daz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daz/32/2475_2.png) [@daz](https://discuss.gradle.org/u/daz)\
**Post date:** [November 10, 2011, 3:12pm UTC](https://discuss.gradle.org/t/how-do-i-always-use-the-latest-version-of-a-changing-module/5314/2 "2011-11-10T15:12:00Z")

</div>

By default, Gradle treats a module version (eg “myorg:myproj:1.0”) as unchanging over time, allowing us to cache the module meta-data and artifacts indefinitely. If you have a module version that has content (meta-data or artifacts) that can change over time, you can mark the module as ‘changing’.

```gradle
dependencies {
    compile group: "group", name: "projectA", version: "1.1", changing: true
}

```

Normally, Gradle will still cache changing modules for a 24 hour period. You can configure this cache timeout using something like:

```gradle
configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

```

You can read more about dynamic versions and changing modules [here](http://gradle.org/releases/latest/docs/userguide/dependency_management.html#sub:dynamic_versions_and_changing_modules).

---

<div class="post-metadata">

**Author:** ![vpranavkumar1](https://avatars.discourse-cdn.com/v4/letter/v/977dab/32.png) [@vpranavkumar1](https://discuss.gradle.org/u/vpranavkumar1)\
**Post date:** [November 11, 2011, 8:56am UTC](https://discuss.gradle.org/t/how-do-i-always-use-the-latest-version-of-a-changing-module/5314/3 "2011-11-11T08:56:00Z")

</div>

Thanks Daz,

Is resolutionStrategy.cacheChangingModulesFor available under 1.0-milestone-5?

---

<div class="post-metadata">

**Author:** ![daz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daz/32/2475_2.png) [@daz](https://discuss.gradle.org/u/daz)\
**Post date:** [November 11, 2011, 7:16pm UTC](https://discuss.gradle.org/t/how-do-i-always-use-the-latest-version-of-a-changing-module/5314/4 "2011-11-11T19:16:00Z")

</div>

No, sorry. I should have pointed out that this is a new feature in Milestone 6. In M5, you’ll get no caching at all, so Gradle will check for a new version every time.
