From d648603634df061900705cc28c5dd60679f073c3 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 29 Jan 2014 16:10:14 -0800 Subject: [PATCH] Exclude *.jar and *.groovy from generated JARs Update `JarCommand` to exclude `**/*.groovy` and `**/*.jar` by default. --- .../boot/cli/command/jar/JarCommand.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java index fffbf484a5..7a34aa88ea 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/jar/JarCommand.java @@ -68,6 +68,12 @@ import org.springframework.util.StringUtils; */ public class JarCommand extends OptionParsingCommand { + private static final String[] DEFAULT_INCLUDES = { "public/**", "static/**", + "resources/**", "META-INF/**", "*" }; + + private static final String[] DEFAULT_EXCLUDES = { ".*", "repository/**", "build/**", + "target/**", "**/*.jar", "**/*.groovy" }; + private static final Layout LAYOUT = new Layouts.Jar(); public JarCommand() { @@ -93,13 +99,11 @@ public class JarCommand extends OptionParsingCommand { this.includeOption = option( "include", "Pattern applied to directories on the classpath to find files to include in the resulting jar") - .withRequiredArg().defaultsTo("public/**", "static/**", - "resources/**", "META-INF/**", "*"); + .withRequiredArg().defaultsTo(DEFAULT_INCLUDES); this.excludeOption = option( "exclude", "Pattern applied to directories on the claspath to find files to exclude from the resulting jar") - .withRequiredArg().defaultsTo(".*", "repository/**", "build/**", - "target/**"); + .withRequiredArg().defaultsTo(DEFAULT_EXCLUDES); } @Override