diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java index 27820b42..c8ef9ca4 100644 --- a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java +++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java @@ -236,8 +236,10 @@ public void logFailedBuildLog( Log logger, boolean ignoreFailures ) buildLogMessage.append( System.lineSeparator() ); buildLogMessage.append( "*** begin build.log for: " + buildJob.getProject() + " ***" ); buildLogMessage.append( System.lineSeparator() ); - FileReader buildLogReader = new FileReader( buildLogFile ); - buildLogMessage.append( IOUtil.toString( buildLogReader ) ); + try ( FileReader buildLogReader = new FileReader( buildLogFile ) ) + { + buildLogMessage.append( IOUtil.toString( buildLogReader ) ); + } buildLogMessage.append( "*** end build.log for: " + buildJob.getProject() + " ***" ); buildLogMessage.append( System.lineSeparator() );