Skip to content

Commit ea2c491

Browse files
author
Dave Syer
committed
Do not delete duplicate directories from main classpath
Before this change we were too aggressive in deleting duplicate resources since directories might not have identical contents, and yet they were being deleted anyway. Fixes gh-614
1 parent b7218f9 commit ea2c491

File tree

1 file changed

+3
-4
lines changed
  • spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven

1 file changed

+3
-4
lines changed

spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.apache.maven.plugins.annotations.Parameter;
3838
import org.apache.maven.plugins.annotations.ResolutionScope;
3939
import org.apache.maven.project.MavenProject;
40-
import org.codehaus.plexus.util.FileUtils;
4140
import org.springframework.boot.loader.tools.AgentAttacher;
4241
import org.springframework.boot.loader.tools.MainClassFinder;
4342

@@ -208,11 +207,11 @@ private void removeDuplicatesFromTarget(File directory) throws IOException {
208207
for (String name : directory.list()) {
209208
File targetFile = new File(this.classesDirectory, name);
210209
if (targetFile.exists() && targetFile.canWrite()) {
211-
if (targetFile.isDirectory()) {
212-
FileUtils.deleteDirectory(targetFile);
210+
if (!targetFile.isDirectory()) {
211+
targetFile.delete();
213212
}
214213
else {
215-
targetFile.delete();
214+
removeDuplicatesFromTarget(targetFile);
216215
}
217216
}
218217
}

0 commit comments

Comments
 (0)