Delete existing sources jar when re-running jar processors. Fixes #560
parent
240a23f52d
commit
6fd3d5d021
|
@ -76,6 +76,7 @@ public abstract class ProcessedNamedMinecraftProvider<M extends MinecraftProvide
|
|||
|
||||
for (Path inputJar : inputJars) {
|
||||
final Path outputJar = getProcessedPath(inputJar);
|
||||
deleteSimilarJars(outputJar);
|
||||
|
||||
Files.copy(inputJar, outputJar, StandardCopyOption.REPLACE_EXISTING);
|
||||
jarProcessorManager.process(outputJar.toFile());
|
||||
|
@ -87,6 +88,15 @@ public abstract class ProcessedNamedMinecraftProvider<M extends MinecraftProvide
|
|||
}
|
||||
}
|
||||
|
||||
private void deleteSimilarJars(Path jar) throws IOException {
|
||||
Files.deleteIfExists(jar);
|
||||
|
||||
for (Path path : Files.list(jar.getParent()).filter(Files::isRegularFile)
|
||||
.filter(path -> path.getFileName().startsWith(jar.getFileName().toString().replace(".jar", ""))).toList()) {
|
||||
Files.deleteIfExists(path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName(String name) {
|
||||
return "%s%s-%s".formatted(projectMappedName, name, getTargetNamespace().toString());
|
||||
|
|
Loading…
Reference in New Issue