Create output directory when it does not exist

git-svn-id: https://svn.apache.org/repos/asf/struts/maven/trunk@750143 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java b/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
index 429edba..d3a1bbb 100644
--- a/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
+++ b/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
@@ -353,9 +353,15 @@
             transformer.setOutputProperty(OutputKeys.INDENT, "yes");
             transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
 
+            //create output directory if it does not exists
+            File outputFile = new File(getOption("outFile"));
+            File parentDir = outputFile.getParentFile();
+            if (!parentDir.exists())
+                parentDir.mkdirs();
+
             Source source = new DOMSource(document);
             Result result = new StreamResult(new OutputStreamWriter(
-                    new FileOutputStream(getOption("outFile"))));
+                    new FileOutputStream(outputFile)));
             transformer.transform(source, result);
         } catch (Exception e) {
             // oops we cannot throw checked exceptions