in repository/service/src/main/java/org/apache/karaf/cave/repository/service/RepositoryServiceImpl.java [576:609]
public void deleteArtifact(String groupId, String artifactId, String version, String type, String classifier, String name) throws Exception {
Map<String, String> coordinates = new HashMap<>();
coordinates.put("groupId", groupId);
coordinates.put("artifactId", artifactId);
coordinates.put("version", version);
if (type == null) {
coordinates.put("extension", "jar");
} else {
coordinates.put("extension", type);
}
coordinates.put("classifier", classifier);
if (repositories.get(name).getLocation() != null) {
Path path = Paths.get(repositories.get(name).getLocation()).resolve(Paths.get(convertMvnCoordinatesToPath(coordinates)));
if (Files.exists(path)) {
if (Files.isDirectory(path)) {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
} else {
Files.delete(path);
}
}
}
}