When the repository import task runs, it stores metadata ( delta files ) about import progress in a hidden sub-directory of the source directory at these paths
.nexus was chosen as parent because any content in this directory is not accessible by HTTP access if the parent storage directory is for a NXRM 2 repository ( a common use case )
Sometimes the import task may need to be restarted, and the admin may wish to restart the import from scratch, without retaining any progress thus far. To do this, all progress and files generated by a previous run of the import task need to be manually deleted.
The problem the file layout creates is if the source directory is a NXRM 2 repository storage location, a .nexus directory already exists which contains well-known directories NXRM 2 uses such as
Combined with the fact that the import task stores dat files are in a nest structure under .nexus, selecting the files to delete without harming files needed by NXRM 2 for normal operation can be overly complicated and dangerous.
Change the default source location to store import task dat files from
By doing this, the only command that an admin needs to run to reset the import data files is
Instead of a complicated command excluding important files and finding relevant files in a deep nested structure.
However to handle the scenario where import task is run before and then after upgrading to an NXRM version that has this change, add a simple check for a file at .nexus/imported-files*.dat at start of task. If that file is present, then act like the root delta directory is still .nexus/
Always log the location of the delta file root directory at INFO level regardless.
Locate the source .nexus directory of the import.
In repository 2 repo storage, the default locations would be like sonatype-work/nexus/storage/<repoid>/.nexus
For example if the source repo id was 'releases', the directory relative to install dir would be sonatype-work/nexus/storage/releases/.nexus
Use a command like this to find and delete all the import cache files: