diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index 89c4d0516c71..72c18747cd81 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -460,7 +460,9 @@ private String escape(CharSequence content) { } static ArgFile create(CharSequence content) throws IOException { - ArgFile argFile = new ArgFile(Files.createTempFile("spring-boot-", ".argfile")); + Path tempFile = Files.createTempFile("spring-boot-", ".argfile"); + tempFile.toFile().deleteOnExit(); + ArgFile argFile = new ArgFile(tempFile); argFile.write(content); return argFile; }