Gradle changing dependencies managment


(Oleksandr Ivanov) #1

Hi Community.
I want to share my problem with you. Maybe somebody faced this problem also and will have solution.
In brief Gradle doesn’t resolve frequently changing dependencies.
We’re using:

./gradlew -v

------------------------------------------------------------
Gradle 2.12
------------------------------------------------------------

Build time:   2016-03-14 08:32:03 UTC
Build number: none
Revision:     b29fbb64ad6b068cb3f05f7e40dc670472129bc0

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_66 (Oracle Corporation 25.66-b17)
OS:           Linux 2.6.18-409.el5 amd64

Let me try to explain what’s happened.
We have some project that have dependency of another independent project.
Both are under active development.
One is: string-parser version: 1.0.0-SNAPSHOT
Second is: tools-utils version: 2.2.0-SNAPSHOT
We have internal maven artifactory and we configured it in string-parser:

# some code there
configurations.all {
  resolutionStrategy.cacheChangingModulesFor 0, TimeUnit.MILLISECONDS
}

 repositories {
    mavenLocal()
    maven { url 'https://some.internal.com/deploy-snapshot'}
    maven { url 'https://some.internal.com/deploy-release'}
  }

dependencies {
# Some other dependencies listed here
  compile('com.some.group:tools-utils:2.2.0-SNAPSHOT') {
    changing = true
  }
}

So when we’re doing changes at local work station (Windows - I think it doesn’t matter) for tools-utils and upload last snapshot artifact version to maven local and remote everything is okay. We go to string-parser project press “reimport” button (in Intellij Idea 2016.1.2) and Gradle switch to correct dependency version.
But if somebody does some changes and upload new version to Maven remote it won’t update dependency in cache and still point to old version. To fix it we have manually delete artifact from Gradle cache and :exclamation: from Maven Local.

Could you please advice me something because cleaning up cache manually (or with addition step on TeamCity) is a nightmare?

Thank you in advance.