Source:
public void delete(String storageId, String repositoryId, String path, boolean force) throws IOException, SearchException { logger.debug("Removing " + storageId + ":" + repositoryId + ":" + path + "..."); Storage storage = getConfiguration().getStorage(storageId); Repository repository = storage.getRepository(repositoryId); RepositoryPath repositoryPath = resolve(repository).resolve(path); if (!Files.isDirectory(repositoryPath)) { deleteFromIndex(repositoryPath); } else { String[] artifactCoordinateElements = path.split("/"); StringBuilder groupId = new StringBuilder(); for (int i = 0; i < artifactCoordinateElements.length - 2; i++) { String element = artifactCoordinateElements[i]; groupId.append((groupId.length() == 0) ? element : "." + element); } String artifactId = artifactCoordinateElements[artifactCoordinateElements.length - 2]; String version = artifactCoordinateElements[artifactCoordinateElements.length - 1]; String pomFilePath = path + "/" + artifactId + "-" + version + ".pom"; if (Files.exists(resolve(repository).resolve(pomFilePath))) { SearchRequest request = new SearchRequest(storageId, repositoryId, "+g:" + groupId + " " + "+a:" + artifactId + " " + "+v:" + version, MavenIndexerSearchProvider.ALIAS); try { SearchResults results = artifactSearchService.search(request); for (SearchResult result : results.getResults()) { String artifactPath = result.getArtifactCoordinates().toPath(); logger.debug("Removing " + artifactPath + " from index..."); deleteFromIndex(resolve(repository, result.getArtifactCoordinates())); } } catch (SearchException e) { logger.error(e.getMessage(), e); } } } closeIndex(repositoryPath); super.delete(storageId, repositoryId, path, force); deleteMetadata(storageId, repositoryId, path); }

Target:
public void delete(String storageId, String repositoryId, String path, boolean force) throws IOException, SearchException { logger.debug("Removing " + storageId + ":" + repositoryId + ":" + path + "..."); Storage storage = getConfiguration().getStorage(storageId); Repository repository = storage.getRepository(repositoryId); RepositoryPath repositoryPath = resolve(repository).resolve(path); if (!Files.isDirectory(repositoryPath)) { deleteFromIndex(repositoryPath); } else { String[] artifactCoordinateElements = path.split("/"); StringBuilder groupId = new StringBuilder(); for (int i = 0; i < artifactCoordinateElements.length - 2; i++) { String element = artifactCoordinateElements[i]; groupId.append((groupId.length() == 0) ? element : "." + element); } String artifactId = artifactCoordinateElements[artifactCoordinateElements.length - 2]; String version = artifactCoordinateElements[artifactCoordinateElements.length - 1]; String pomFilePath = path + "/" + artifactId + "-" + version + ".pom"; if (Files.exists(resolve(repository).resolve(pomFilePath))) { SearchRequest request = new SearchRequest(storageId, repositoryId, "+g:" + groupId + " " + "+a:" + artifactId + " " + "+v:" + version, MavenIndexerSearchProvider.ALIAS); try { SearchResults results = artifactSearchService.search(request); for (SearchResult result : results.getResults()) { String artifactPath = result.getArtifactCoordinates().toPath(); logger.debug("Removing " + artifactPath + " from index..."); deleteFromIndex(resolve(repository, result.getArtifactCoordinates())); } } catch (SearchException e) { logger.error(e.getMessage(), e); } } } super.delete(storageId, repositoryId, path, force); deleteMetadata(storageId, repositoryId, path); }