title: How do you deal with maven-3 timestamped snapshots efficiently?
body: <p>Now that maven-3 did <a href="https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-NonuniqueSnapshotDeployments" rel="noreferrer">drop support</a> for the &lt;uniqueVersion&gt;false&lt;/uniqueVersion&gt; for snapshot artefacts it seems that you really need to use timestamped SNAPSHOTS. Especially m2eclipse, which does use maven 3 internally seems to be affected with it, update-snapshots does not work when the SNAPSHOTS are not unique.</p>
  
  <p>It seemed best <a href="https://stackoverflow.com/questions/1243574/how-to-stop-maven-artifactory-from-keeping-snapshots-with-timestamps">practice before</a> to set all snapshots to uniqueVersion=false</p>
  
  <p>Now, it seems no big problem to switch to the timestamped version, after all they are managed by a central nexus repository, which is able to delete old snapshots in regular intervalls.</p>
  
  <p>The problem are the local developer workstations. Their local repository quickly does grow <em>very</em> large with unique snapshots.</p>
  
  <p>How to deal with this problem ?</p>
  
  <p>Right now i see the folowing possible solutions:</p>
  
  <ul>
  <li>Ask the developers to purge the repository in regular intervals (which leads to lots of fustration, as it takes long time to delete and even longer to download everything needed)</li>
  <li>Set up some script which does delete all <em>SNAPSHOT</em> directories from the local repository and ask developers to run that script from time to time (better than the first, but still takes quite some time to run and download current snapshots)</li>
  <li>use the dependency:purge-local-repository plugin (Does have problems when run from eclipse, due to open files, needs to be run from each project)</li>
  <li>set up nexus on every workstation and set up a job to clean old snapshots (best result, but I don't want to maintain 50+ nexus servers, plus memory is always tight on developer workstations)</li>
  <li>stop using SNAPSHOTS at all </li>
  </ul>
  
  <p>What is the best way to keep your local repository from filling up your hard drive space ?</p>
  
  <p>Update:</p>
  
  <p>To verify the beaviour and to give more info i setup a small nexus server, build two projects (a and b) and try:</p>
  
  <p>a:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;de.glauche&lt;/groupId&gt;
    &lt;artifactId&gt;a&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;distributionManagement&gt;
      &lt;snapshotRepository&gt;
          &lt;id&gt;nexus&lt;/id&gt;
          &lt;name&gt;nexus&lt;/name&gt;
          &lt;url&gt;http://server:8081/nexus/content/repositories/snapshots&lt;/url&gt;
      &lt;/snapshotRepository&gt;
    &lt;/distributionManagement&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>b:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;de.glauche&lt;/groupId&gt;
    &lt;artifactId&gt;b&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;distributionManagement&gt;
      &lt;snapshotRepository&gt;
          &lt;id&gt;nexus&lt;/id&gt;
          &lt;name&gt;nexus&lt;/name&gt;
          &lt;url&gt;http://server:8081/nexus/content/repositories/snapshots/&lt;/url&gt;
      &lt;/snapshotRepository&gt;
    &lt;/distributionManagement&gt;
   &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;nexus&lt;/id&gt;
          &lt;name&gt;nexus&lt;/name&gt;
          &lt;snapshots&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
          &lt;/snapshots&gt;
          &lt;url&gt;http://server:8081/nexus/content/repositories/snapshots/&lt;/url&gt;
      &lt;/repository&gt;
   &lt;/repositories&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;de.glauche&lt;/groupId&gt;
          &lt;artifactId&gt;a&lt;/artifactId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Now, when i use maven and run "deploy" on "a", i'll have</p>
  
  <pre><code>a-0.0.1-SNAPSHOT.jar
  a-0.0.1-20101204.150527-6.jar
  a-0.0.1-SNAPSHOT.pom
  a-0.0.1-20101204.150527-6.pom
  </code></pre>
  
  <p>in the local repository. With a new timestamp version each time i run the deploy target. The same happens when i try to update Snapshots from the nexus server (close "a" Project, delete it from local repository, build "b")</p>
  
  <p>In an environment where lots of snapshots get build (think hudson server ...), the local reposioty fills up with old versions <strong>fast</strong></p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>To test how and why this is failing i did some more tests. Each test is run against clean everything (de/glauche gets delete from both machines and nexus)</p>
  
  <ul>
  <li>mvn deploy with maven 2.2.1 :</li>
  </ul>
  
  <p>local repository on machine A does contain snapshot.jar + snapshot-timestamp.jar </p>
  
  <p>BUT: only one timestamped jar in nexus, metadata reads:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;metadata&gt;
    &lt;groupId&gt;de.glauche&lt;/groupId&gt;
    &lt;artifactId&gt;a&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;versioning&gt;
      &lt;snapshot&gt;
        &lt;timestamp&gt;20101206.200039&lt;/timestamp&gt;
  
        &lt;buildNumber&gt;1&lt;/buildNumber&gt;
      &lt;/snapshot&gt;
      &lt;lastUpdated&gt;20101206200039&lt;/lastUpdated&gt;
    &lt;/versioning&gt;
  &lt;/metadata&gt;
  </code></pre>
  
  <ul>
  <li>run update dependencies (on machine B) in m2eclipse (embedded m3 final) -> local repository has snapshot.jar + snapshot-timestamp.jar :(</li>
  <li>run package goal with external maven 2.2.1 -> local repository has snapshot.jar + snapshot-timestamp.jar :(</li>
  </ul>
  
  <p>Ok, next try with maven 3.0.1 (after removing all traces of project a)</p>
  
  <ul>
  <li><p>local repository on machine A looks better, only one one non-timestamped jar</p></li>
  <li><p>only one timestamped jar in nexus, metadata reads:</p>
  
  
  
  <p>
    de.glauche
    a
    0.0.1-SNAPSHOT
    </p>
  
  <pre><code>&lt;snapshot&gt;
    &lt;timestamp&gt;20101206.201808&lt;/timestamp&gt;
    &lt;buildNumber&gt;3&lt;/buildNumber&gt;
  &lt;/snapshot&gt;
  &lt;lastUpdated&gt;20101206201808&lt;/lastUpdated&gt;
  &lt;snapshotVersions&gt;
    &lt;snapshotVersion&gt;
      &lt;extension&gt;jar&lt;/extension&gt;
      &lt;value&gt;0.0.1-20101206.201808-3&lt;/value&gt;
      &lt;updated&gt;20101206201808&lt;/updated&gt;
    &lt;/snapshotVersion&gt;
    &lt;snapshotVersion&gt;
      &lt;extension&gt;pom&lt;/extension&gt;
      &lt;value&gt;0.0.1-20101206.201808-3&lt;/value&gt;
      &lt;updated&gt;20101206201808&lt;/updated&gt;
    &lt;/snapshotVersion&gt;
  &lt;/snapshotVersions&gt;
  </code></pre>
  
  <p>
  </p></li>
  <li><p>run update dependencies (on machine B) in m2eclipse (embedded m3 final) -> local repository has snapshot.jar + snapshot-timestamp.jar :(</p></li>
  <li><p>run package goal with external maven 2.2.1 -> local repository has snapshot.jar + snapshot-timestamp.jar :(</p></li>
  </ul>
  
  <p>So, to recap: The "deploy" goal in maven3 works better than in 2.2.1, the local repository on the creating machine looks fine.
  But, the receiver always ends up with lots of timestamed versions ...</p>
  
  <p>What am i doing wrong ?</p>
  
  <p><strong>Update 3</strong></p>
  
  <p>I also did test various other configurations, first replace nexus with artifactory -> same behaviour. Then use linux maven 3 clients to download the snapshots from the repository manager -> local repository still has timestamped snapshots :(</p>