title: Maven 3 does not update snapshot dependency from local repository
body: <p>I am trying to use external library inside my maven project. Since I want the project to build out of the box on any machine, I don't want to use <code>mvn install</code> solution. I have therefore defined local repository in my pom.xml:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.test&lt;/groupId&gt;
          &lt;artifactId&gt;fooLib&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
      ....
      &lt;repository&gt;
          &lt;id&gt;in-project&lt;/id&gt;
          &lt;snapshots&gt;
              &lt;updatePolicy&gt;always&lt;/updatePolicy&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
          &lt;/snapshots&gt;
          &lt;name&gt;In Project Repo&lt;/name&gt;
          &lt;url&gt;file://${project.basedir}/libRepo&lt;/url&gt;
      &lt;/repository&gt;
  </code></pre>
  
  <p>The problem is when I replace the jar in <code>libRepo</code> (without updating version number since it is just another snapshot) that this updated jar is not used (old version from <code>.m2</code> directory is used instead) even for <code>mvn -U clean install</code>
  How to make maven to update this jar?</p>
  
  <p><strong>EDIT</strong>:
  According to <a href="https://stackoverflow.com/questions/5901378/what-exactly-is-a-maven-snapshot-and-why-do-we-need-it">What exactly is a Maven Snapshot and why do we need it?</a> maven shall try to find never version of SNAPSHOT dependency, "even if a version of this library is found on the local repository". What is wrong with my setting?</p>
  
  <p><strong>DIRTY SOLUTION</strong>:
  Based on answer from <a href="https://stackoverflow.com/questions/2065928/maven-2-assembly-with-dependencies-jar-under-scope-system-not-included">Maven 2 assembly with dependencies: jar under scope &quot;system&quot; not included</a> following extension of my original solution seems to work:</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-install-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;hack-binary&lt;/id&gt;
                      &lt;phase&gt;validate&lt;/phase&gt;
                      &lt;configuration&gt;
                          &lt;file&gt;${repo.path.to.jar}&lt;/file&gt;
                          &lt;repositoryLayout&gt;default&lt;/repositoryLayout&gt;
                          &lt;groupId&gt;com.test&lt;/groupId&gt;
                          &lt;artifactId&gt;fooLib&lt;/artifactId&gt;
                          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
                          &lt;packaging&gt;jar&lt;/packaging&gt;
                          &lt;generatePom&gt;true&lt;/generatePom&gt;
                      &lt;/configuration&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;install-file&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>As mentioned in comment to that solution, it does not work alone, thus it works in combination with <code>in-project</code> repository (which works when the dependency is not available in local <code>.m2</code> repository) and this second parts refreshes <code>.m2</code> during every build. </p>
  
  <p>However it is still not clear to me why ordinary "SNAPSHOT" mechanism does not work (i.e. current dirty solution would work also without SNAPSHOTs as local <code>.m2</code> repo is explicitly updated every time). Is there any cleaner way?</p>
  
  <p><strong>SOLUTION</strong> (based on Aaron's answer &amp; discussion): The problem was that I tried to install file into <code>libRepo</code> using <code>install-file</code>. The actual solution is that if library updates, use </p>
  
  <pre><code>mvn deploy:deploy-file -Dfile=fooLib.jar  -DgroupId=com.test \
      -DartifactId=fooLib -Dversion=1.0-SNAPSHOT -Dpackaging=jar \
      -Durl=file://..\libRepo -DrepositoryId=in-project
  </code></pre>
  
  <p>to deployed it to repo. After proper deploy, maven correctly handles SNAPSHOTs.</p>