From 9621b2aaffb5062bee6803f372f5a19ad60ae40c Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 3 Nov 2016 16:35:17 +0000 Subject: [PATCH] Be defensive about creating directories for files Maven 3.4 snapshots are now being published with invalid zip files, where the entries are listed before their parent. So the logic in the Installer is faulty: you have to mkdirs() on all entries to be sure that the directory exists before you write the file. --- .../src/main/java/org/apache/maven/wrapper/Installer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/maven-wrapper/src/main/java/org/apache/maven/wrapper/Installer.java b/maven-wrapper/src/main/java/org/apache/maven/wrapper/Installer.java index 5adc3c20ce..9f6b22fd69 100644 --- a/maven-wrapper/src/main/java/org/apache/maven/wrapper/Installer.java +++ b/maven-wrapper/src/main/java/org/apache/maven/wrapper/Installer.java @@ -170,6 +170,7 @@ public class Installer { continue; } + new File(dest, entry.getName()).getParentFile().mkdirs(); copyInputStream(zipFile.getInputStream(entry), new BufferedOutputStream(new FileOutputStream(new File(dest, entry.getName())))); } zipFile.close();