diff --git a/codegen-maven-plugin/src/main/java/software/amazon/awssdk/codegen/maven/plugin/GenerationMojo.java b/codegen-maven-plugin/src/main/java/software/amazon/awssdk/codegen/maven/plugin/GenerationMojo.java index 3d17b4d84bb2..9e59e82abdb1 100644 --- a/codegen-maven-plugin/src/main/java/software/amazon/awssdk/codegen/maven/plugin/GenerationMojo.java +++ b/codegen-maven-plugin/src/main/java/software/amazon/awssdk/codegen/maven/plugin/GenerationMojo.java @@ -236,6 +236,13 @@ private Optional loadOptionalModel(Class clzz, Path location) { private void emitValidationReport(ModelValidationReport report) { Path modelsDir = sourcesDirectory.resolve("models"); + try { + Files.createDirectories(modelsDir); + } catch (IOException e) { + getLog().warn(String.format("Failed to create directory %s, unable to write validation-report.json", modelsDir), e); + return; + } + try (Writer writer = Files.newBufferedWriter(modelsDir.resolve("validation-report.json"), StandardCharsets.UTF_8);) {