title: How to specify "updatepolicy" for Gradle-build using mavenLocal()
body: <p>I am using Gradle as build tool for my projects. Besides my local development computer there is a Nexus repository manager caching packages from Maven Central (and others) as well as local release- and SNAPSHOT-builds, which are published at least daily by Jenkins CI.</p>
  
  <p>In <code>build.gradle</code> I have the following definition of repos:</p>
  
  <pre><code>repositories {
    mavenLocal()
    maven { url http://url.to.nexus:8081/nexus/... }
    flatDir {
      ...
    }
  }
  </code></pre>
  
  <p>The project (<code>A</code>) references several internal libraries (e.g. <code>B</code>) - also in SNAPSHOT versions. If I build <code>A</code>, the referenced SNAPSHOT-version of <code>B</code> is fetched from Nexus since there is no version in <code>mavenLocal</code> and Jenkins published the desired version - so everything is fine.</p>
  
  <p>If I change some things in <code>B</code> and want to use immediately in <code>A</code>, I build/install <code>B</code> locally (using <code>gradle install</code>) and the current SNAPSHOT goes into <code>mavenLocal</code> making it available for the build of <code>A</code>.
  But from this time, the library <code>B</code> is <strong>always</strong> fetched from <code>mavenLocal</code>. Even if after some time a colleague changes <code>B</code> and there is a newer SNAPSHOT version available on Nexus it won't be used.</p>
  
  <p>Using Maven it would be possible to specify an <code>updatePolicy</code> like <code>daily</code> (which is also the default) solving the problem. But I don't see a way how to do this in Gradle (except purging <code>~/.m2/repository</code> once per day).</p>
  
  <p><strong>== UPDATE ==</strong></p>
  
  <p>According to the comment of jlb, I would like to add:</p>
  
  <p>I don't have any repositories defined in the Maven-settings since dependency-resolution and artifact download are completely managed by gradle. So all repositories are only defined in the Gradle's build scripts.
  Using the local Maven-repository is just an (often recommended) workaround in order to use local (intermediate) builds of libs in other projects without the need to publish them every time to some repository manager. IMO this is essential when extending libraries (<code>B</code> in the example above).</p>
  
  <p>In addition, this only works if the order of the repository is defined as stated above. If an artifact of the same snapshot-version exists on a repository, further repos will not be checked, even if there might be newer (snapshot)-builds available there.</p>