Enhance JarCommand to support lists of includes and excludes

The lists are comma separated. In addition, user can add prefixes
"+" or "-", to signal that those values should be removed from the
default list, not added to a fresh one. E.g.

$ spring jar app.jar --include lib/*.jar,-static/** --exclude -**/*.jar

to include a jar file specifically, and make sure it is not excluded,
and additionally not include the static/** resources that would otherwise
be included in the defaults. As soon as "+" or "-" prefixes are detected
the default entries are all added (except the ones exlcuded with "-").

Fixes gh-1090
This commit is contained in:
Dave Syer
2014-06-12 18:08:33 +01:00
parent d842446186
commit 2c691e5ae5
6 changed files with 142 additions and 20 deletions

View File

@@ -265,9 +265,25 @@ executable jar file. For example:
$ spring jar my-app.jar *.groovy
----
The resulting jar will contain the classes produced by compiling the application and all
of the application's dependencies so that it can then be run using `java -jar`. The jar
file will also contain entries from the application's classpath.
The resulting jar will contain the classes produced by compiling the
application and all of the application's dependencies so that it can
then be run using `java -jar`. The jar file will also contain entries
from the application's classpath. You can add explicit paths to the
jar using `--include` and `--exclude` (both are comma separated, and
both accept prefixes to the values "+" and "-" to signify that they
shoudl be removed from the defaults). The default includes are
[indent=0]
----
public/**, resources/**, static/**, templates/**, META-INF/**, *
----
and the default excludes are
[indent=0]
----
.*, repository/**, build/**, target/**, **/*.jar, **/*.groovy
----
See the output of `spring help jar` for more information.