From 0c04fa091d9848ed51898d30a6e32f18167864f5 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Thu, 29 Feb 2024 16:50:47 +0100 Subject: [PATCH] More Refactoring --- .../boot/jarmode/layertools/Command.java | 26 ++++++++++++-- .../jarmode/layertools/ExtractCommand.java | 3 +- .../layertools/ExtractLayersCommand.java | 15 ++++++-- .../boot/jarmode/layertools/HelpCommand.java | 35 ++++++++++++++----- .../jarmode/layertools/LayerToolsJarMode.java | 2 +- .../boot/jarmode/layertools/ListCommand.java | 16 +++++++-- .../jarmode/layertools/ListLayersCommand.java | 6 ++-- .../boot/jarmode/layertools/Runner.java | 34 ++++++++++++------ .../boot/jarmode/layertools/ToolsJarMode.java | 2 +- .../boot/jarmode/layertools/CommandTests.java | 5 +-- .../layertools/ExtractLayersCommandTests.java | 11 +++--- .../jarmode/layertools/ListCommandTests.java | 4 +-- .../boot/jarmode/layertools/TestCommand.java | 3 +- .../error-option-missing-value-output.txt | 2 ++ .../error-option-unknown-output.txt | 2 ++ .../list-output-without-deprecation.txt | 3 ++ .../boot/jarmode/layertools/list-output.txt | 2 ++ 17 files changed, 129 insertions(+), 42 deletions(-) create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/list-output-without-deprecation.txt diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/Command.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/Command.java index 5a5164123d19..17b688f09785 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/Command.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/Command.java @@ -16,6 +16,7 @@ package org.springframework.boot.jarmode.layertools; +import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -32,6 +33,7 @@ * * @author Phillip Webb * @author Scott Frederick + * @author Moritz Halbritter */ abstract class Command { @@ -91,9 +93,10 @@ Parameters getParameters() { /** * Run the command by processing the remaining arguments. + * @param out stream for command output * @param args a mutable deque of the remaining arguments */ - final void run(Deque args) { + final void run(PrintStream out, Deque args) { List parameters = new ArrayList<>(); Map options = new HashMap<>(); while (!args.isEmpty()) { @@ -106,15 +109,32 @@ final void run(Deque args) { parameters.add(arg); } } - run(options, parameters); + run(out, options, parameters); } /** * Run the actual command. + * @param out stream for command output * @param options any options extracted from the arguments * @param parameters any parameters extracted from the arguments */ - protected abstract void run(Map options, List parameters); + protected abstract void run(PrintStream out, Map options, List parameters); + + /** + * Whether the command is deprecated. + * @return whether the command is deprecated + */ + protected boolean isDeprecated() { + return false; + } + + /** + * Returns the deprecation message. + * @return the deprecation message + */ + protected String getDeprecationMessage() { + return null; + } /** * Static method that can be used to find a single command from a collection. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ExtractCommand.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ExtractCommand.java index 075081697980..5eb6e86fd5c7 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ExtractCommand.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ExtractCommand.java @@ -21,6 +21,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.io.PrintStream; import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.attribute.BasicFileAttributeView; @@ -86,7 +87,7 @@ class ExtractCommand extends Command { } @Override - public void run(Map options, List parameters) { + public void run(PrintStream out, Map options, List parameters) { try { File destination = getWorkingDirectory(options); Layers layers = getLayers(options); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ExtractLayersCommand.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ExtractLayersCommand.java index f97d60019248..21ea730cfd11 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ExtractLayersCommand.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ExtractLayersCommand.java @@ -16,6 +16,7 @@ package org.springframework.boot.jarmode.layertools; +import java.io.PrintStream; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -45,14 +46,24 @@ class ExtractLayersCommand extends Command { } @Override - protected void run(Map options, List parameters) { + protected boolean isDeprecated() { + return true; + } + + @Override + protected String getDeprecationMessage() { + return "Use '-Djarmode=tools extract --layers --launcher' instead."; + } + + @Override + protected void run(PrintStream out, Map options, List parameters) { Map rewrittenOptions = new HashMap<>(); if (options.containsKey(DESTINATION_OPTION)) { rewrittenOptions.put(ExtractCommand.DESTINATION_OPTION, options.get(DESTINATION_OPTION)); } rewrittenOptions.put(ExtractCommand.LAYERS_OPTION, StringUtils.collectionToCommaDelimitedString(parameters)); rewrittenOptions.put(ExtractCommand.LAUNCHER_OPTION, null); - this.delegate.run(rewrittenOptions, Collections.emptyList()); + this.delegate.run(out, rewrittenOptions, Collections.emptyList()); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/HelpCommand.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/HelpCommand.java index dfaaf631a0e4..f7c807949c5a 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/HelpCommand.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/HelpCommand.java @@ -25,6 +25,7 @@ * Implicit {@code 'help'} command. * * @author Phillip Webb + * @author Moritz Halbritter */ class HelpCommand extends Command { @@ -39,24 +40,34 @@ class HelpCommand extends Command { } HelpCommand(Context context, List commands, String jarMode) { - super("help", "Help about any command", Options.none(), Parameters.of("[]")); this.context = context; this.commands = commands; this.jarMode = (jarMode != null) ? jarMode : "tools"; } @Override - protected void run(Map options, List parameters) { - run(System.out, parameters); + protected void run(PrintStream out, Map options, List parameters) { + run(out, parameters); } void run(PrintStream out, List parameters) { - Command command = (!parameters.isEmpty()) ? Command.find(this.commands, parameters.get(0)) : null; - if (command != null) { - printCommandHelp(out, command); + String commandName = (parameters.isEmpty()) ? null : parameters.get(0); + if (commandName == null) { + printUsageAndCommands(null, out); + return; + } + if (getName().equals(commandName)) { + printCommandHelp(out, this); return; } - printUsageAndCommands(out); + Command command = Command.find(this.commands, commandName); + if (command == null) { + printUsageAndCommands(commandName, out); + } + else { + printCommandHelp(out, command); + } } private void printCommandHelp(PrintStream out, Command command) { @@ -86,7 +97,10 @@ private String getUsage(Command command) { return usage.toString(); } - private void printUsageAndCommands(PrintStream out) { + private void printUsageAndCommands(String commandName, PrintStream out) { + if (commandName != null) { + printError(out, "Unknown command \"%s\"".formatted(commandName)); + } out.println("Usage:"); out.println(" " + getJavaCommand()); out.println(); @@ -108,4 +122,9 @@ private String getJavaCommand() { return "java -Djarmode=" + this.jarMode + " -jar " + this.context.getArchiveFile().getName(); } + private void printError(PrintStream out, String errorMessage) { + out.println("Error: " + errorMessage); + out.println(); + } + } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/LayerToolsJarMode.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/LayerToolsJarMode.java index 0c8fec51b5cc..66ec1c90208c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/LayerToolsJarMode.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/LayerToolsJarMode.java @@ -40,7 +40,7 @@ public boolean accepts(String mode) { public void run(String mode, String[] args) { try { Context context = (contextOverride != null) ? contextOverride : new Context(); - new Runner(context, getCommands(context)).run(args); + new Runner(System.out, context, getCommands(context)).run(args); } catch (Exception ex) { throw new IllegalStateException(ex); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListCommand.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListCommand.java index e71e138909c9..ff2778bd854a 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListCommand.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListCommand.java @@ -38,12 +38,22 @@ class ListCommand extends Command { } @Override - protected void run(Map options, List parameters) { - this.delegate.run(options, parameters); + protected boolean isDeprecated() { + return true; + } + + @Override + protected String getDeprecationMessage() { + return "Use '-Djarmode=tools list-layers' instead."; + } + + @Override + protected void run(PrintStream out, Map options, List parameters) { + this.delegate.run(out, options, parameters); } void printLayers(Layers layers, PrintStream out) { - this.delegate.printLayers(layers, out); + this.delegate.printLayers(out, layers); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListLayersCommand.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListLayersCommand.java index 1a81e72baa41..c39f8469e8a4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListLayersCommand.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ListLayersCommand.java @@ -35,11 +35,11 @@ class ListLayersCommand extends Command { } @Override - public void run(Map options, List parameters) { - printLayers(Layers.get(this.context), System.out); + public void run(PrintStream out, Map options, List parameters) { + printLayers(out, Layers.get(this.context)); } - void printLayers(Layers layers, PrintStream out) { + void printLayers(PrintStream out, Layers layers) { layers.forEach(out::println); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/Runner.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/Runner.java index 396c3af34ab8..71483668e135 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/Runner.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/Runner.java @@ -16,7 +16,9 @@ package org.springframework.boot.jarmode.layertools; +import java.io.PrintStream; import java.util.ArrayDeque; +import java.util.ArrayList; import java.util.Arrays; import java.util.Deque; import java.util.List; @@ -28,13 +30,17 @@ */ class Runner { - private final List commands; + private final PrintStream out; + + private final List commands = new ArrayList<>(); private final HelpCommand help; - Runner(Context context, List commands) { - this.commands = commands; + Runner(PrintStream out, Context context, List commands) { + this.out = out; + this.commands.addAll(commands); this.help = new HelpCommand(context, commands); + this.commands.add(this.help); } void run(String... args) { @@ -51,26 +57,34 @@ private void run(Deque args) { } printError("Unknown command \"" + commandName + "\""); } - this.help.run(args); + this.help.run(this.out, args); } private void runCommand(Command command, Deque args) { + if (command.isDeprecated()) { + printWarning("This command is deprecated. " + command.getDeprecationMessage()); + } try { - command.run(args); + command.run(this.out, args); } catch (UnknownOptionException ex) { printError("Unknown option \"" + ex.getMessage() + "\" for the " + command.getName() + " command"); - this.help.run(dequeOf(command.getName())); + this.help.run(this.out, dequeOf(command.getName())); } catch (MissingValueException ex) { printError("Option \"" + ex.getMessage() + "\" for the " + command.getName() + " command requires a value"); - this.help.run(dequeOf(command.getName())); + this.help.run(this.out, dequeOf(command.getName())); } } - private void printError(String errorMessage) { - System.out.println("Error: " + errorMessage); - System.out.println(); + private void printWarning(String message) { + this.out.println("Warning: " + message); + this.out.println(); + } + + private void printError(String message) { + this.out.println("Error: " + message); + this.out.println(); } private Deque dequeOf(String... args) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ToolsJarMode.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ToolsJarMode.java index ef7b3b879902..4354bb2b4e0b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ToolsJarMode.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ToolsJarMode.java @@ -39,7 +39,7 @@ public boolean accepts(String mode) { public void run(String mode, String[] args) { try { Context context = (contextOverride != null) ? contextOverride : new Context(); - new Runner(context, getCommands(context)).run(args); + new Runner(System.out, context, getCommands(context)).run(args); } catch (Exception ex) { throw new IllegalStateException(ex); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/CommandTests.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/CommandTests.java index fbae10c5dee9..a6b42b63dce3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/CommandTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/CommandTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.jarmode.layertools; +import java.io.PrintStream; import java.util.ArrayDeque; import java.util.Arrays; import java.util.List; @@ -159,7 +160,7 @@ void shouldNotParseFollowingOptionAsValue() { } private void run(TestCommand command, String... args) { - command.run(new ArrayDeque<>(Arrays.asList(args))); + command.run(System.out, new ArrayDeque<>(Arrays.asList(args))); } static class TestCommand extends Command { @@ -177,7 +178,7 @@ static class TestCommand extends Command { } @Override - protected void run(Map options, List parameters) { + protected void run(PrintStream out, Map options, List parameters) { this.runOptions = options; this.runParameters = parameters; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractLayersCommandTests.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractLayersCommandTests.java index 58dd606112d6..3fc030db3527 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractLayersCommandTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ExtractLayersCommandTests.java @@ -96,7 +96,7 @@ void setup() throws Exception { void runExtractsLayers() { given(this.context.getArchiveFile()).willReturn(this.jarFile); given(this.context.getWorkingDir()).willReturn(this.extract); - this.command.run(Collections.emptyMap(), Collections.emptyList()); + this.command.run(System.out, Collections.emptyMap(), Collections.emptyList()); assertThat(this.extract.list()).containsOnly("a", "b", "c", "d"); assertThat(new File(this.extract, "a/a/a.jar")).exists().satisfies(this::timeAttributes); assertThat(new File(this.extract, "b/b/b.jar")).exists().satisfies(this::timeAttributes); @@ -145,7 +145,8 @@ private FileTime expectedCreationTime() { void runWhenHasDestinationOptionExtractsLayers() { given(this.context.getArchiveFile()).willReturn(this.jarFile); File out = new File(this.extract, "out"); - this.command.run(Collections.singletonMap(ExtractLayersCommand.DESTINATION_OPTION, out.getAbsolutePath()), + this.command.run(System.out, + Collections.singletonMap(ExtractLayersCommand.DESTINATION_OPTION, out.getAbsolutePath()), Collections.emptyList()); assertThat(this.extract.list()).containsOnly("out"); assertThat(new File(this.extract, "out/a/a/a.jar")).exists().satisfies(this::timeAttributes); @@ -157,7 +158,7 @@ void runWhenHasDestinationOptionExtractsLayers() { void runWhenHasLayerParamsExtractsLimitedLayers() { given(this.context.getArchiveFile()).willReturn(this.jarFile); given(this.context.getWorkingDir()).willReturn(this.extract); - this.command.run(Collections.emptyMap(), Arrays.asList("a", "c")); + this.command.run(System.out, Collections.emptyMap(), Arrays.asList("a", "c")); assertThat(this.extract.list()).containsOnly("a", "c"); assertThat(new File(this.extract, "a/a/a.jar")).exists().satisfies(this::timeAttributes); assertThat(new File(this.extract, "c/c/c.jar")).exists().satisfies(this::timeAttributes); @@ -173,7 +174,7 @@ void runWithJarFileContainingNoEntriesFails() throws IOException { given(this.context.getArchiveFile()).willReturn(file); given(this.context.getWorkingDir()).willReturn(this.extract); assertThatIllegalStateException() - .isThrownBy(() -> this.command.run(Collections.emptyMap(), Collections.emptyList())) + .isThrownBy(() -> this.command.run(System.out, Collections.emptyMap(), Collections.emptyList())) .withMessageContaining("not compatible"); } @@ -191,7 +192,7 @@ void runWithJarFileThatWouldWriteEntriesOutsideDestinationFails() throws Excepti given(this.context.getArchiveFile()).willReturn(this.jarFile); given(this.context.getWorkingDir()).willReturn(this.extract); assertThatIllegalStateException() - .isThrownBy(() -> this.command.run(Collections.emptyMap(), Collections.emptyList())) + .isThrownBy(() -> this.command.run(System.out, Collections.emptyMap(), Collections.emptyList())) .withMessageContaining("Entry 'e/../../e.jar' would be written"); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ListCommandTests.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ListCommandTests.java index 62ff0a08e2d9..8880cf982d27 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ListCommandTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ListCommandTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ void setup() throws Exception { void listLayersShouldListLayers() { Layers layers = IndexedLayers.get(this.context); this.command.printLayers(layers, this.out); - assertThat(this.out).hasSameContentAsResource("list-output.txt"); + assertThat(this.out).hasSameContentAsResource("list-output-without-deprecation.txt"); } private File createJarFile(String name) throws Exception { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/TestCommand.java b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/TestCommand.java index 5785c61d07ce..ef8772f06657 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/TestCommand.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/TestCommand.java @@ -16,6 +16,7 @@ package org.springframework.boot.jarmode.layertools; +import java.io.PrintStream; import java.util.List; import java.util.Map; @@ -32,7 +33,7 @@ class TestCommand extends Command { } @Override - protected void run(Map options, List parameters) { + protected void run(PrintStream out, Map options, List parameters) { } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/error-option-missing-value-output.txt b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/error-option-missing-value-output.txt index 6a5034cedd73..18e87069ce09 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/error-option-missing-value-output.txt +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/error-option-missing-value-output.txt @@ -1,3 +1,5 @@ +Warning: This command is deprecated. Use '-Djarmode=tools extract --layers --launcher' instead. + Error: Option "--destination" for the extract command requires a value Extracts layers from the jar for image creation diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/error-option-unknown-output.txt b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/error-option-unknown-output.txt index a207b3b20a21..3b832dd642eb 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/error-option-unknown-output.txt +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/error-option-unknown-output.txt @@ -1,3 +1,5 @@ +Warning: This command is deprecated. Use '-Djarmode=tools extract --layers --launcher' instead. + Error: Unknown option "--invalid" for the extract command Extracts layers from the jar for image creation diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/list-output-without-deprecation.txt b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/list-output-without-deprecation.txt new file mode 100644 index 000000000000..81f6325ca6b9 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/list-output-without-deprecation.txt @@ -0,0 +1,3 @@ +0001 +0002 +0003 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/list-output.txt b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/list-output.txt index 81f6325ca6b9..03f7f88556fa 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/list-output.txt +++ b/spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/resources/org/springframework/boot/jarmode/layertools/list-output.txt @@ -1,3 +1,5 @@ +Warning: This command is deprecated. Use '-Djarmode=tools list-layers' instead. + 0001 0002 0003