diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ConcatFilesTask.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ConcatFilesTask.java index a58fcac60db75..55634c15f0524 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ConcatFilesTask.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ConcatFilesTask.java @@ -83,7 +83,7 @@ public void setAdditionalLines(List additionalLines) { @TaskAction public void concatFiles() throws IOException { if (getHeaderLine() != null) { - getTarget().mkdirs(); + getTarget().getParentFile().mkdirs(); Files.write(getTarget().toPath(), (getHeaderLine() + '\n').getBytes(StandardCharsets.UTF_8)); }