layertools
with a wrong option seems to fail silently.
If I use a correct option with this sample, it succeeds as follows:
$ ./gradlew clean bootJar
BUILD SUCCESSFUL in 1s
4 actionable tasks: 4 executed
$ java -Djarmode=layertools -jar build/libs/spring-boot-throwaway-branches-1.0.jar extract --destination build/temp
$ ls -al build/temp/
total 0
drwxr-xr-x 6 user staff 192 Jun 21 11:29 .
drwxr-xr-x 8 user staff 256 Jun 21 11:29 ..
drwxr-xr-x 4 user staff 128 Jun 21 11:29 application
drwxr-xr-x 3 user staff 96 Jun 21 11:29 dependencies
drwxr-xr-x 2 user staff 64 Jun 21 11:29 snapshot-dependencies
drwxr-xr-x 3 user staff 96 Jun 21 11:29 spring-boot-loader
$
However, if I use a wrong option, it seems to fail silently as follows:
$ ./gradlew clean bootJar
BUILD SUCCESSFUL in 1s
4 actionable tasks: 4 executed
$ java -Djarmode=layertools -jar build/libs/spring-boot-throwaway-branches-1.0.jar extract --destination=build/temp
$ ls -al build/temp/
ls: build/temp/: No such file or directory
$ ls -al
total 56
drwxr-xr-x 15 user staff 480 Jun 21 11:30 .
drwxr-xr-x 67 user staff 2144 Jun 18 16:35 ..
drwxr-xr-x 16 user staff 512 Jun 21 11:27 .git
-rw-r--r-- 1 user staff 109 Jun 11 09:56 .gitignore
drwxr-xr-x 12 user staff 384 Jun 20 22:29 .gradle
drwxr-xr-x 14 user staff 448 Jun 21 11:24 .idea
drwxr-xr-x 7 user staff 224 Jun 21 11:30 build
-rw-r--r-- 1 user staff 1151 Jun 21 10:38 build.gradle
drwxr-xr-x 3 user staff 96 Dec 12 2018 gradle
-rw-r--r-- 1 user staff 0 Jun 12 15:57 gradle.properties
-rwxr-xr-x 1 user staff 5770 Jun 12 16:50 gradlew
-rw-r--r-- 1 user staff 3058 Jun 12 16:50 gradlew.bat
-rw-r--r-- 1 user staff 53 Dec 12 2018 settings.gradle
-rw-r--r-- 1 user staff 760 Dec 12 2018 spring-boot-throwaway-branches.iml
drwxr-xr-x 4 user staff 128 Nov 7 2019 src
$
If I omit the destination
option, it succeeds as follows:
$ java -Djarmode=layertools -jar build/libs/spring-boot-throwaway-branches-1.0.jar extract
$ ls -al
total 56
drwxr-xr-x 19 user staff 608 Jun 21 11:31 .
drwxr-xr-x 67 user staff 2144 Jun 18 16:35 ..
drwxr-xr-x 16 user staff 512 Jun 21 11:27 .git
-rw-r--r-- 1 user staff 109 Jun 11 09:56 .gitignore
drwxr-xr-x 12 user staff 384 Jun 20 22:29 .gradle
drwxr-xr-x 14 user staff 448 Jun 21 11:24 .idea
drwxr-xr-x 4 user staff 128 Jun 21 11:31 application
drwxr-xr-x 7 user staff 224 Jun 21 11:30 build
-rw-r--r-- 1 user staff 1151 Jun 21 10:38 build.gradle
drwxr-xr-x 3 user staff 96 Jun 21 11:31 dependencies
drwxr-xr-x 3 user staff 96 Dec 12 2018 gradle
-rw-r--r-- 1 user staff 0 Jun 12 15:57 gradle.properties
-rwxr-xr-x 1 user staff 5770 Jun 12 16:50 gradlew
-rw-r--r-- 1 user staff 3058 Jun 12 16:50 gradlew.bat
-rw-r--r-- 1 user staff 53 Dec 12 2018 settings.gradle
drwxr-xr-x 2 user staff 64 Jun 21 11:31 snapshot-dependencies
drwxr-xr-x 3 user staff 96 Jun 21 11:31 spring-boot-loader
-rw-r--r-- 1 user staff 760 Dec 12 2018 spring-boot-throwaway-branches.iml
drwxr-xr-x 4 user staff 128 Nov 7 2019 src
$
Comment From: philwebb
Yeah, I've hit that one before as well. I think we should consider this a bug.
Comment From: scottfrederick
However, if I use a wrong option, it seems to fail silently as follows:
For the record, what's happening is that --destination=build/temp
isn't recognized as a valid option so it is being treated as a layer
parameter. Since there are no layers named --destination=build/temp
to extract, the command runs but has nothing to do. The validation should be tightened up so that an unrecognized option (e.g. something that starts with "--") results in an error.