diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java index 43c07a1f..44bcc874 100644 --- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java +++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java @@ -27,6 +27,7 @@ import java.io.IOException; import java.io.OutputStream; import java.io.Reader; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -854,7 +855,7 @@ else if ( "plain".equals( outputFileFormat ) ) { // Write a plain output file to the standard output file, // and write an XML output file to the temp directory that can be used to count violations - outputXmlFile = File.createTempFile( "checkstyle-result", ".xml" ); + outputXmlFile = Files.createTempFile( "checkstyle-result", ".xml" ).toFile(); outputXmlFile.deleteOnExit(); OutputStream xmlOut = getOutputStream( outputXmlFile ); CompositeAuditListener compoundListener = new CompositeAuditListener();