Allow remote restart to work with nested JARs
Update remote restart support so that JARs multi-module projects work. Fixes gh-4040
This commit is contained in:
@@ -204,7 +204,7 @@ public class Restarter {
|
||||
*/
|
||||
public void addUrls(Collection<URL> urls) {
|
||||
Assert.notNull(urls, "Urls must not be null");
|
||||
this.urls.addAll(ChangeableUrls.fromUrls(urls).toList());
|
||||
this.urls.addAll(urls);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
package org.springframework.boot.devtools.restart.server;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -38,6 +41,11 @@ public class DefaultSourceFolderUrlFilter implements SourceFolderUrlFilter {
|
||||
private static final Pattern VERSION_PATTERN = Pattern
|
||||
.compile("^-\\d+(?:\\.\\d+)*(?:[.-].+)?$");
|
||||
|
||||
private static final Set<String> SKIPPED_PROJECTS = new HashSet<String>(
|
||||
Arrays.asList("spring-boot", "spring-boot-devtools",
|
||||
"spring-boot-autoconfigure", "spring-boot-actuator",
|
||||
"spring-boot-starter"));
|
||||
|
||||
@Override
|
||||
public boolean isMatch(String sourceFolder, URL url) {
|
||||
String jarName = getJarName(url);
|
||||
@@ -68,7 +76,7 @@ public class DefaultSourceFolderUrlFilter implements SourceFolderUrlFilter {
|
||||
}
|
||||
|
||||
private boolean isFolderMatch(String folder, String jarName) {
|
||||
if (!jarName.startsWith(folder)) {
|
||||
if (!jarName.startsWith(folder) || SKIPPED_PROJECTS.contains(folder)) {
|
||||
return false;
|
||||
}
|
||||
String version = jarName.substring(folder.length());
|
||||
|
||||
Reference in New Issue
Block a user