From c98642c2f79234e58d6496a283599bd856657a45 Mon Sep 17 00:00:00 2001 From: Eric Bottard Date: Tue, 8 Aug 2017 17:18:20 +0200 Subject: [PATCH] Add starter, make adapter kick in only if needed --- pom.xml | 6 +++ spring-shell-jcommander-adapter/pom.xml | 1 + ...derParameterResolverAutoConfiguration.java | 4 ++ spring-shell-samples/pom.xml | 27 ++++++------ spring-shell-shell1-adapter/pom.xml | 1 + .../LegacyAdapterAutoConfiguration.java | 3 ++ spring-shell-starter/pom.xml | 41 +++++++++++++++++++ 7 files changed, 70 insertions(+), 13 deletions(-) create mode 100644 spring-shell-starter/pom.xml diff --git a/pom.xml b/pom.xml index 497ed2de..82ec2e8c 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,7 @@ spring-shell-jcommander-adapter spring-shell-samples spring-shell-shell1-adapter + spring-shell-starter @@ -63,6 +64,11 @@ spring-shell-jcommander-adapter ${project.version} + + org.springframework.shell + spring-shell-starter + ${project.version} + org.jline diff --git a/spring-shell-jcommander-adapter/pom.xml b/spring-shell-jcommander-adapter/pom.xml index 573cbd91..e11c3737 100644 --- a/spring-shell-jcommander-adapter/pom.xml +++ b/spring-shell-jcommander-adapter/pom.xml @@ -23,6 +23,7 @@ com.beust jcommander 1.48 + true org.springframework.boot diff --git a/spring-shell-jcommander-adapter/src/main/java/org/springframework/shell/jcommander/JCommanderParameterResolverAutoConfiguration.java b/spring-shell-jcommander-adapter/src/main/java/org/springframework/shell/jcommander/JCommanderParameterResolverAutoConfiguration.java index b0e772c5..74580f60 100644 --- a/spring-shell-jcommander-adapter/src/main/java/org/springframework/shell/jcommander/JCommanderParameterResolverAutoConfiguration.java +++ b/spring-shell-jcommander-adapter/src/main/java/org/springframework/shell/jcommander/JCommanderParameterResolverAutoConfiguration.java @@ -16,6 +16,9 @@ package org.springframework.shell.jcommander; +import com.beust.jcommander.JCommander; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Bean; @@ -25,6 +28,7 @@ import org.springframework.context.annotation.Bean; * @author Eric Bottard */ @Configuration +@ConditionalOnClass(JCommander.class) public class JCommanderParameterResolverAutoConfiguration { @Bean diff --git a/spring-shell-samples/pom.xml b/spring-shell-samples/pom.xml index f2e35238..08d74ba5 100644 --- a/spring-shell-samples/pom.xml +++ b/spring-shell-samples/pom.xml @@ -27,27 +27,28 @@ + + org.springframework.shell - spring-shell-core + spring-shell-starter + + org.springframework.shell - spring-shell-standard + spring-shell + 1.2.0.RELEASE + + - org.springframework.shell - spring-shell-standard-commands - runtime - - - org.springframework.shell - spring-shell-shell1-adapter - - - org.springframework.shell - spring-shell-jcommander-adapter + com.beust + jcommander + 1.48 + + diff --git a/spring-shell-shell1-adapter/pom.xml b/spring-shell-shell1-adapter/pom.xml index 64876872..22f50cdb 100644 --- a/spring-shell-shell1-adapter/pom.xml +++ b/spring-shell-shell1-adapter/pom.xml @@ -25,6 +25,7 @@ org.springframework.shell spring-shell 1.2.0.RELEASE + true org.springframework.boot diff --git a/spring-shell-shell1-adapter/src/main/java/org/springframework/shell/legacy/LegacyAdapterAutoConfiguration.java b/spring-shell-shell1-adapter/src/main/java/org/springframework/shell/legacy/LegacyAdapterAutoConfiguration.java index 3f8b017f..849ea4e4 100644 --- a/spring-shell-shell1-adapter/src/main/java/org/springframework/shell/legacy/LegacyAdapterAutoConfiguration.java +++ b/spring-shell-shell1-adapter/src/main/java/org/springframework/shell/legacy/LegacyAdapterAutoConfiguration.java @@ -15,6 +15,7 @@ */ package org.springframework.shell.legacy; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -22,6 +23,7 @@ import org.springframework.context.annotation.FilterType; import org.springframework.shell.converters.ArrayConverter; import org.springframework.shell.converters.AvailableCommandsConverter; import org.springframework.shell.converters.SimpleFileConverter; +import org.springframework.shell.core.annotation.CliCommand; /** * Main configuration class for the Shell 2 - Shell 1 adapter. @@ -29,6 +31,7 @@ import org.springframework.shell.converters.SimpleFileConverter; * @author Camilo Gonzalez */ @Configuration +@ConditionalOnClass(CliCommand.class) @ComponentScan(basePackageClasses = {ArrayConverter.class}, excludeFilters = @ComponentScan.Filter( type = FilterType.ASSIGNABLE_TYPE, value = {AvailableCommandsConverter.class, SimpleFileConverter.class})) diff --git a/spring-shell-starter/pom.xml b/spring-shell-starter/pom.xml new file mode 100644 index 00000000..9494ff65 --- /dev/null +++ b/spring-shell-starter/pom.xml @@ -0,0 +1,41 @@ + + 4.0.0 + + spring-shell-starter + Spring Shell Starter + jar + + + org.springframework.shell + spring-shell-parent + 2.0.0.BUILD-SNAPSHOT + + + Starter Dependency for Using Spring Shell + + + + org.springframework.shell + spring-shell-core + + + org.springframework.shell + spring-shell-standard + + + org.springframework.shell + spring-shell-standard-commands + runtime + + + org.springframework.shell + spring-shell-shell1-adapter + + + org.springframework.shell + spring-shell-jcommander-adapter + + + +