title: Deleting artifacts on disk from Apache Archiva
body: <p>I've removed a bunch of old versions (2.0.0 -> 2.0.6) of an artifact from archiva by deleting the files directly from the repository on disk (linux hosted). Unfortunately I can't get Archiva to rebuild its index of artifacts and recognise that the versions no longer exist. </p>
  
  <p>I've tried</p>
  
  <ul>
  <li>Index Scanning on the repository.</li>
  <li>Directory Scanning on the repository.</li>
  <li>Bouncing the Archiva process.</li>
  <li>Sacrificing my first born child. </li>
  <li>Manually deleting the version from the UI -> This works, that's why 2.0.0 doesn't appear in the list</li>
  </ul>
  
  <p>If I inspect the directory structure on disk, I can see that the maven-metadata.xml only contains the versions which remain, so that has been rebuilt correctly.</p>
  
  <p>Here's what the filesystem looks like (hosts/users etc. sanitized):</p>
  
  <pre><code>[13:51] Linux [myuser@myarchivahost:/net/nas/Archiva/repository/myproject-release/com/mycompany/myartifact]&gt; ls -al
  total 24
  drwx------  5 root root 4096 Jul 25 15:07 .
  drwx------ 23 root root 4096 Jul 12 18:15 ..
  drwx------  2 root root 4096 Jun 29 15:00 2.0.7
  drwx------  2 root root 4096 Jun 29 15:00 2.0.8
  drwx------  2 root root 4096 Jul 13 10:00 2.0.9
  -rwx------  1 root root  401 Jul 26 13:37 maven-metadata.xml
  -rwx------  1 root root   52 Jul 26 13:37 maven-metadata.xml.md5
  -rwx------  1 root root   60 Jul 26 13:37 maven-metadata.xml.sha1
  </code></pre>
  
  <p>Here's the contents of the maven-metadata.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;metadata&gt;
    &lt;groupId&gt;com.mycompany&lt;/groupId&gt;
    &lt;artifactId&gt;myartifact&lt;/artifactId&gt;
    &lt;versioning&gt;
      &lt;latest&gt;2.0.9&lt;/latest&gt;
      &lt;release&gt;2.0.9&lt;/release&gt;
      &lt;versions&gt;
        &lt;version&gt;2.0.7&lt;/version&gt;
        &lt;version&gt;2.0.8&lt;/version&gt;
        &lt;version&gt;2.0.9&lt;/version&gt;
      &lt;/versions&gt;
      &lt;lastUpdated&gt;20160726123734&lt;/lastUpdated&gt;
    &lt;/versioning&gt;
  &lt;/metadata&gt;
  </code></pre>
  
  <p>Here's a screenshot of the stubborn UI
  <a href="https://i.stack.imgur.com/mHRDH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mHRDH.png" alt="enter image description here"></a></p>
  
  <p>The REST API is similarly cached:</p>
  
  <p><a href="http://myarchivahost/restServices/archivaServices/browseService/versionsList/com.mycompany/myartifact" rel="nofollow noreferrer">http://myarchivahost/restServices/archivaServices/browseService/versionsList/com.mycompany/myartifact</a></p>
  
  <pre><code>&lt;versionsList&gt;
    &lt;versions&gt;2.0.1&lt;/versions&gt;
    &lt;versions&gt;2.0.2&lt;/versions&gt;
    &lt;versions&gt;2.0.3&lt;/versions&gt;
    &lt;versions&gt;2.0.4&lt;/versions&gt;
    &lt;versions&gt;2.0.5&lt;/versions&gt;
    &lt;versions&gt;2.0.6&lt;/versions&gt;
    &lt;versions&gt;2.0.7&lt;/versions&gt;
    &lt;versions&gt;2.0.8&lt;/versions&gt;
    &lt;versions&gt;2.0.9&lt;/versions&gt;
  &lt;/versionsList&gt;
  </code></pre>