Search code examples
mavenarchiva

Deleting artifacts on disk from Apache Archiva


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.

I've tried

  • Index Scanning on the repository.
  • Directory Scanning on the repository.
  • Bouncing the Archiva process.
  • Sacrificing my first born child.
  • Manually deleting the version from the UI -> This works, that's why 2.0.0 doesn't appear in the list

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.

Here's what the filesystem looks like (hosts/users etc. sanitized):

[13:51] Linux [myuser@myarchivahost:/net/nas/Archiva/repository/myproject-release/com/mycompany/myartifact]> 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

Here's the contents of the maven-metadata.xml

<?xml version="1.0" encoding="UTF-8"?>

<metadata>
  <groupId>com.mycompany</groupId>
  <artifactId>myartifact</artifactId>
  <versioning>
    <latest>2.0.9</latest>
    <release>2.0.9</release>
    <versions>
      <version>2.0.7</version>
      <version>2.0.8</version>
      <version>2.0.9</version>
    </versions>
    <lastUpdated>20160726123734</lastUpdated>
  </versioning>
</metadata>

Here's a screenshot of the stubborn UI enter image description here

The REST API is similarly cached:

http://myarchivahost/restServices/archivaServices/browseService/versionsList/com.mycompany/myartifact

<versionsList>
  <versions>2.0.1</versions>
  <versions>2.0.2</versions>
  <versions>2.0.3</versions>
  <versions>2.0.4</versions>
  <versions>2.0.5</versions>
  <versions>2.0.6</versions>
  <versions>2.0.7</versions>
  <versions>2.0.8</versions>
  <versions>2.0.9</versions>
</versionsList>

Solution

  • This isn't the ideal solution, but it's all I've got right now.

    • Perform cleanup operation
    • Delete all maven-metadata files from disk
    • Recreate the repository from disk information.