From 154fa37604559736478387d67aeb7ed86b7bf9b0 Mon Sep 17 00:00:00 2001 From: John Dennis Casey Date: Thu, 3 Nov 2005 21:17:07 +0000 Subject: [PATCH] PR: MNG-1345 Submitted By: Edwin Punzalan Reviewed By: John Casey Applied Edwin's patch to create the resource-target directory if it doesn't exist. Thanks for the work, Edwin! Also, I modified this patch slightly per Jerome's suggestion, to fail with a message if outputDir.mkdirs() doesn't succeed. This is fine, since it's within the scope of !outputDir.exists(). git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@330639 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/plugin/resources/ResourcesMojo.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java b/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java index b32517174e..3de1ae99f2 100644 --- a/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java +++ b/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java @@ -127,6 +127,17 @@ public class ResourcesMojo continue; } + // this part is required in case the user specified "../something" as destination + // see MNG-1345 + File outputDir = new File( outputDirectory ); + if ( !outputDir.exists() ) + { + if ( !outputDir.mkdirs() ) + { + throw new MojoExecutionException( "Cannot create resource output directory: " + outputDir ); + } + } + DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir( resource.getDirectory() );