From 0580edf1cc4ea4cb61f017ccf44dcdbc3b583d90 Mon Sep 17 00:00:00 2001 From: KERN Christian Date: Tue, 10 Sep 2024 13:19:43 +0200 Subject: [PATCH 1/2] Fixes #42908 --- .../dev/filesystem/QuarkusFileManager.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java index 4ac5314804078..7852c0370f0a7 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java @@ -22,6 +22,8 @@ protected QuarkusFileManager(StandardJavaFileManager fileManager, Context contex this.fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, List.of(context.getGeneratedSourcesDirectory())); } if (context.getAnnotationProcessorPaths() != null) { + // Paths might be missing! (see: https://github.com/quarkusio/quarkus/issues/42908) + ensureDirectories(context.getAnnotationProcessorPaths()); this.fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, context.getAnnotationProcessorPaths()); } } catch (IOException e) { @@ -39,12 +41,22 @@ public void reset(Context context) { this.fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, List.of(context.getGeneratedSourcesDirectory())); } if (context.getAnnotationProcessorPaths() != null) { + // Paths might be missing! (see: https://github.com/quarkusio/quarkus/issues/42908) + ensureDirectories(context.getAnnotationProcessorPaths()); this.fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, context.getAnnotationProcessorPaths()); } } catch (IOException e) { throw new RuntimeException("Cannot reset file manager", e); } } + + private void ensureDirectories(Iterable directories){ + for (File processorPath : directories) { + if (!processorPath.exists()) { + processorPath.mkdirs(); + } + } + } @Override public void close() throws IOException { From dd8ae2cf88ec16075be9b967f2ae73596a6bc9e0 Mon Sep 17 00:00:00 2001 From: KERN Christian Date: Tue, 10 Sep 2024 15:56:38 +0200 Subject: [PATCH 2/2] Added Runtime exception on failing directory creation --- .../dev/filesystem/QuarkusFileManager.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java index 7852c0370f0a7..71bd65e54830d 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java @@ -49,11 +49,14 @@ public void reset(Context context) { throw new RuntimeException("Cannot reset file manager", e); } } - - private void ensureDirectories(Iterable directories){ - for (File processorPath : directories) { - if (!processorPath.exists()) { - processorPath.mkdirs(); + + private void ensureDirectories(Iterable directories) { + for (File directory : directories) { + if (!directory.exists()) { + final boolean success = directory.mkdirs(); + if (!success) { + throw new RuntimeException("Cannot create directory " + directory); + } } } }