Source:
public void execute(RepositoryPath path) throws IOException { List<Path> filePathList = Files.walk(path) .filter(p -> !p.getFileName().startsWith(".pom")) .sorted() .collect(Collectors.toList()); RepositoryPath parentPath = path.getParent() .toAbsolutePath(); if (filePathList.isEmpty()) { return; } if (!getVisitedRootPaths().isEmpty() && getVisitedRootPaths().containsKey(parentPath)) { List<RepositoryPath> visitedVersionPaths = getVisitedRootPaths().get(parentPath); if (visitedVersionPaths.contains(path)) { return; } } if (logger.isDebugEnabled()) { System.out.println(parentPath); } if (previousPath != null && !parentPath.startsWith(previousPath)) { getVisitedRootPaths().remove(previousPath); previousPath = parentPath; } if (previousPath == null) { previousPath = parentPath; } List<RepositoryPath> versionDirectories = getVersionDirectories(parentPath); if (versionDirectories != null) { getVisitedRootPaths().put(parentPath, versionDirectories); VersionCollector versionCollector = new VersionCollector(); VersionCollectionRequest request = versionCollector.collectVersions(path.getParent() .toAbsolutePath()); if (logger.isDebugEnabled()) { for (RepositoryPath directory : versionDirectories) { System.out.println(" " + directory.toAbsolutePath()); } } RepositoryPath artifactPath = path.getRepositoryRelative(); try { mavenSnapshotManager.deleteTimestampedSnapshotArtifacts(getRepository(), artifactPath.toString(), request, numberToKeep, keepPeriod); } catch (IOException | ProviderImplementationException | NoSuchAlgorithmException | ParseException | XmlPullParserException e) { logger.error("Failed to delete timestamped snapshot artifacts for " + artifactPath, e); } } }

Target:
public void execute(RepositoryPath path) throws IOException { List<Path> filePathList = Files.walk(path) .filter(p -> !p.getFileName().startsWith(".pom")) .sorted() .collect(Collectors.toList()); RepositoryPath parentPath = path.getParent() .toAbsolutePath(); if (filePathList.isEmpty()) { return; } if (!getVisitedRootPaths().isEmpty() && getVisitedRootPaths().containsKey(parentPath)) { List<RepositoryPath> visitedVersionPaths = getVisitedRootPaths().get(parentPath); if (visitedVersionPaths.contains(path)) { return; } } if (logger.isDebugEnabled()) { System.out.println(parentPath); } if (previousPath != null && !parentPath.startsWith(previousPath)) { getVisitedRootPaths().remove(previousPath); previousPath = parentPath; } if (previousPath == null) { previousPath = parentPath; } List<RepositoryPath> versionDirectories = getVersionDirectories(parentPath); if (versionDirectories != null) { getVisitedRootPaths().put(parentPath, versionDirectories); VersionCollector versionCollector = new VersionCollector(); VersionCollectionRequest request = versionCollector.collectVersions(path.getParent() .toAbsolutePath()); if (logger.isDebugEnabled()) { for (RepositoryPath directory : versionDirectories) { System.out.println(" " + directory.toAbsolutePath()); } } RepositoryPath artifactPath = path.getRepositoryRelative(); try { mavenSnapshotManager.deleteTimestampedSnapshotArtifacts(artifactPath.getFileSystem().getRepository(), artifactPath.toString(), request, numberToKeep, keepPeriod); } catch (IOException | ProviderImplementationException | NoSuchAlgorithmException | ParseException | XmlPullParserException e) { logger.error("Failed to delete timestamped snapshot artifacts for " + artifactPath, e); } } }