Configure --refresh-dependencies in init.gradle


(m m) #1

Hi , I would like to configure --refresh-dependencies in init.gradle so that it need not be passed as command line for each individual project.

I configured like below

resolutionStrategy {
   cacheDynamicVersionsFor 0, "seconds"
          cacheChangingModulesFor 0, "seconds"
}

We also need to mention {changing=true} for those dependencies which needs to be refreshed.

The problem i face is that i want {changing=true} to be applied to all dependencies whose group name starts with specific string. Not sure whether it is possible to define matching group names in init.gradle . Let me know if there are any api to achieve this.


(Gary Hale) #2

So you want to preset in init.gradle that any dependencies that might be declared in subprojects that have a particular group should always be changing=true?

Would something like this work?

rootProject {
  allprojects {
    afterEvaluation {
      configurations.compile.allDependencies.findAll { it.group == "somegroup" }.each { it.changing=true }
    }
  }
}

(m m) #3

Thanks Gary. This should work. I will try .


(m m) #4

Thanks. It worked