Commit 487ab1a6 authored by Andrew Landsverk's avatar Andrew Landsverk Committed by Stephane Nicoll

Prevent restart when META-INF/maven/** changes

These files are modified by Eclipse for some reason when you change files
like Thymeleaf HTML files. `META-INF/maven/**` has been added to the
default exclusion.

Closes gh-3295
Closes gh-3297
parent 92a6e318
......@@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty;
@ConfigurationProperties(prefix = "spring.devtools")
public class DevToolsProperties {
private static final String DEFAULT_RESTART_EXCLUDES = "META-INF/resources/**,resources/**,static/**,public/**,templates/**";
private static final String DEFAULT_RESTART_EXCLUDES = "META-INF/maven/**,META-INF/resources/**,resources/**,static/**,public/**,templates/**";
private static final long DEFAULT_RESTART_POLL_INTERVAL = 1000;
......
......@@ -19,8 +19,7 @@ package org.springframework.boot.devtools.classpath;
import java.io.File;
import org.junit.Test;
import org.springframework.boot.devtools.classpath.ClassPathRestartStrategy;
import org.springframework.boot.devtools.classpath.PatternClassPathRestartStrategy;
import org.springframework.boot.devtools.filewatch.ChangedFile;
import org.springframework.boot.devtools.filewatch.ChangedFile.Type;
......@@ -31,6 +30,7 @@ import static org.junit.Assert.assertThat;
* Tests for {@link PatternClassPathRestartStrategy}.
*
* @author Phillip Webb
* @author Andrew Landsverk
*/
public class PatternClassPathRestartStrategyTests {
......@@ -66,6 +66,16 @@ public class PatternClassPathRestartStrategyTests {
assertRestartRequired(strategy, "src/folder/file.txt", true);
}
@Test
public void pomChange() throws Exception {
ClassPathRestartStrategy strategy = createStrategy("META-INF/maven/**");
assertRestartRequired(strategy, "pom.xml", true);
assertRestartRequired(strategy,
"META-INF/maven/org.springframework.boot/spring-boot-devtools/pom.xml", false);
assertRestartRequired(strategy,
"META-INF/maven/org.springframework.boot/spring-boot-devtools/pom.properties", false);
}
private ClassPathRestartStrategy createStrategy(String pattern) {
return new PatternClassPathRestartStrategy(pattern);
}
......
......@@ -828,10 +828,10 @@ commercially supported.
==== Excluding resources
Certain resources don't necessarily need to trigger a restart when they are changed. For
example, Thymeleaf templates can just be edited in-place. By default changing resources
in `/META-INF/resources` ,`/resources` ,`/static` ,`/public` or `/templates` will not
trigger a restart. If you want to customize these exclusions you can use the
`spring.devtools.restart.exclude` property. For example, to exclude only `/static` and
`/public` you would set the following:
in `/META-INF/maven`, ``/META-INF/resources` ,`/resources` ,`/static` ,`/public` or
`/templates` will not trigger a restart. If you want to customize these exclusions you
can use the `spring.devtools.restart.exclude` property. For example, to exclude only
`/static` and `/public` you would set the following:
[indent=0]
----
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment