diff --git a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/sources/ProtoSourceResolver.java b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/sources/ProtoSourceResolver.java index 80ebd64f..46214ad0 100644 --- a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/sources/ProtoSourceResolver.java +++ b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/sources/ProtoSourceResolver.java @@ -179,7 +179,9 @@ private Path getArchiveExtractionRoot() { } private String generateUniqueName(Path path) { - var digest = Digests.sha1(path.toAbsolutePath().toString()); + // Use a URI here as the URI will correctly encapsulate archives within archives. Paths may have + // name collisions between archives using the same relative file paths internally. + var digest = Digests.sha1(FileUtils.normalize(path).toUri().toASCIIString()); return FileUtils.getFileNameWithoutExtension(path) + "-" + digest; } }