cbeust/testng — pull request #532 by isavin (2014-07-09 12:51:07+00:00)
Title: Create the parent directory if it's missing.

Using:
-usedefaultlisteners false -listener org.testng.reporters.XMLReporter

If the target/surefire-reports dir doesn't exist (first build or after clean) saving the xml reports will fail with:
java.io.FileNotFoundException: /home/build/project/target/surefire-reports/testng-results.xml (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:221)
at java.io.FileOutputStream.(FileOutputStream.java:171)
at java.io.FileWriter.(FileWriter.java:90)
at org.testng.internal.Utils.writeUtf8File(Utils.java:107)
at org.testng.reporters.XMLReporter.generateReport(XMLReporter.java:66)
at org.testng.TestNG.generateReports(TestNG.java:1115)
at org.testng.TestNG.run(TestNG.java:1074)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:128)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:112)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:112)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

The changes in this PR check if the output directory is present and create it if it's missing.