Skip to content

Commit 9d472e8

Browse files
committed
Merge branch '4.1.x'
Closes gh-50960
2 parents 046d4c6 + 15c7518 commit 9d472e8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • build-plugin/spring-boot-antlib/src/main/java/org/springframework/boot/ant

build-plugin/spring-boot-antlib/src/main/java/org/springframework/boot/ant/FindMainClass.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ public void execute() throws BuildException {
7171
if (this.classesRoot.isDirectory()) {
7272
return MainClassFinder.findSingleMainClass(this.classesRoot, SPRING_BOOT_APPLICATION_CLASS_NAME);
7373
}
74-
return MainClassFinder.findSingleMainClass(new JarFile(this.classesRoot), "/",
75-
SPRING_BOOT_APPLICATION_CLASS_NAME);
74+
try (JarFile jarFile = new JarFile(this.classesRoot)) {
75+
return MainClassFinder.findSingleMainClass(jarFile, "/", SPRING_BOOT_APPLICATION_CLASS_NAME);
76+
}
7677
}
7778
catch (IOException ex) {
7879
throw new BuildException(ex);

0 commit comments

Comments
 (0)