From 54faaa8948d40b2915b0ebb8a3c242d42af5738f Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sun, 28 Jul 2024 15:42:40 -0400 Subject: [PATCH] Earlier detection of mkdirs failure (#201) --- .../site/descriptor/SiteDescriptorArtifactMetadata.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/maven/plugins/site/descriptor/SiteDescriptorArtifactMetadata.java b/src/main/java/org/apache/maven/plugins/site/descriptor/SiteDescriptorArtifactMetadata.java index bd36b376..7ad31e73 100644 --- a/src/main/java/org/apache/maven/plugins/site/descriptor/SiteDescriptorArtifactMetadata.java +++ b/src/main/java/org/apache/maven/plugins/site/descriptor/SiteDescriptorArtifactMetadata.java @@ -69,7 +69,10 @@ public void storeInLocalRepository(ArtifactRepository localRepository, ArtifactR File destination = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata(this, remoteRepository)); - destination.getParentFile().mkdirs(); + if (!destination.getParentFile().mkdirs()) { + throw new RepositoryMetadataStoreException( + "Could not create artifact directory " + destination + " in local repository"); + } try (Writer writer = new XmlStreamWriter(destination)) { new SiteXpp3Writer().write(writer, siteModel);