Browse Source

Add templates/** to list of default includes for CLI jars

Boot promotes the use of a templates directory for housing view
templates. Include this directory by default when building a jar file
from a CLI app.

Fixes #455
pull/465/merge
Andy Wilkinson 12 years ago
parent
commit
44826812db
  1. 5
      spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java
  2. 5
      spring-boot-cli/src/it/resources/jar-command/jar.groovy
  3. 0
      spring-boot-cli/src/it/resources/jar-command/public/public.txt
  4. 0
      spring-boot-cli/src/it/resources/jar-command/resources/resource.txt
  5. 0
      spring-boot-cli/src/it/resources/jar-command/static/static.txt
  6. 0
      spring-boot-cli/src/it/resources/jar-command/templates/template.txt
  7. 4
      spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java

5
spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java

@ -74,6 +74,9 @@ public class JarCommandIT { @@ -74,6 +74,9 @@ public class JarCommandIT {
assertThat(invocation.getErrorOutput(), equalTo(""));
assertThat(invocation.getStandardOutput(), containsString("Hello World!"));
assertThat(invocation.getStandardOutput(), containsString("/static/test.txt"));
assertThat(invocation.getStandardOutput(), containsString("/public/public.txt"));
assertThat(invocation.getStandardOutput(), containsString("/resources/resource.txt"));
assertThat(invocation.getStandardOutput(), containsString("/static/static.txt"));
assertThat(invocation.getStandardOutput(), containsString("/templates/template.txt"));
}
}

5
spring-boot-cli/src/it/resources/jar-command/jar.groovy

@ -8,7 +8,10 @@ class Example implements CommandLineRunner { @@ -8,7 +8,10 @@ class Example implements CommandLineRunner {
void run(String... args) {
println "Hello ${this.myService.sayWorld()}"
println getClass().getResource('/static/test.txt')
println getClass().getResource('/public/public.txt')
println getClass().getResource('/resources/resource.txt')
println getClass().getResource('/static/static.txt')
println getClass().getResource('/templates/template.txt')
}
}

0
spring-boot-cli/src/it/resources/jar-command/static/test.txt → spring-boot-cli/src/it/resources/jar-command/public/public.txt

0
spring-boot-cli/src/it/resources/jar-command/resources/resource.txt

0
spring-boot-cli/src/it/resources/jar-command/static/static.txt

0
spring-boot-cli/src/it/resources/jar-command/templates/template.txt

4
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java

@ -65,8 +65,8 @@ import org.springframework.util.Assert; @@ -65,8 +65,8 @@ import org.springframework.util.Assert;
*/
public class JarCommand extends OptionParsingCommand {
private static final String[] DEFAULT_INCLUDES = { "public/**", "static/**",
"resources/**", "META-INF/**", "*" };
private static final String[] DEFAULT_INCLUDES = { "public/**", "resources/**",
"static/**", "templates/**", "META-INF/**", "*" };
private static final String[] DEFAULT_EXCLUDES = { ".*", "repository/**", "build/**",
"target/**", "**/*.jar", "**/*.groovy" };

Loading…
Cancel
Save