Browse Source

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
pull/626/head
Dave Syer 12 years ago
parent
commit
ea2c491d1f
  1. 7
      spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java

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

@ -37,7 +37,6 @@ import org.apache.maven.plugins.annotations.Mojo; @@ -37,7 +37,6 @@ import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
import org.springframework.boot.loader.tools.AgentAttacher;
import org.springframework.boot.loader.tools.MainClassFinder;
@ -208,11 +207,11 @@ public class RunMojo extends AbstractMojo { @@ -208,11 +207,11 @@ public class RunMojo extends AbstractMojo {
for (String name : directory.list()) {
File targetFile = new File(this.classesDirectory, name);
if (targetFile.exists() && targetFile.canWrite()) {
if (targetFile.isDirectory()) {
FileUtils.deleteDirectory(targetFile);
if (!targetFile.isDirectory()) {
targetFile.delete();
}
else {
targetFile.delete();
removeDuplicatesFromTarget(targetFile);
}
}
}

Loading…
Cancel
Save