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..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 @@ -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,6 +41,8 @@ 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) { @@ -46,6 +50,17 @@ public void reset(Context context) { } } + 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); + } + } + } + } + @Override public void close() throws IOException { super.close();