diff --git a/common/src/main/java/net/neoforged/gradle/common/extensions/repository/IvyDummyRepositoryExtension.java b/common/src/main/java/net/neoforged/gradle/common/extensions/repository/IvyDummyRepositoryExtension.java index 7d58ce2e1..387f4e2db 100644 --- a/common/src/main/java/net/neoforged/gradle/common/extensions/repository/IvyDummyRepositoryExtension.java +++ b/common/src/main/java/net/neoforged/gradle/common/extensions/repository/IvyDummyRepositoryExtension.java @@ -168,12 +168,16 @@ private void writeDummyDataIfNeeded( writeIvyMetadataFile(entry, jarFile, baseDir, metaFile); - Files.deleteIfExists(jarFile); - Files.createFile(jarFile); + if (!Files.isRegularFile(jarFile)) { + FileUtils.delete(jarFile); + Files.createFile(jarFile); + } final Path sourcesFile = entry.asSources().buildArtifactPath(getRepositoryDirectory().get().getAsFile().toPath()); - Files.deleteIfExists(sourcesFile); - Files.createFile(sourcesFile); + if (!Files.isRegularFile(sourcesFile)) { + FileUtils.delete(sourcesFile); + Files.createFile(sourcesFile); + } writeDummyDependencyDataIfNeeded(entry); }