Add starter, make adapter kick in only if needed

This commit is contained in:
Eric Bottard
2017-08-08 17:18:20 +02:00
parent c3c7f1fccd
commit c98642c2f7
7 changed files with 70 additions and 13 deletions

View File

@@ -28,6 +28,7 @@
<module>spring-shell-jcommander-adapter</module>
<module>spring-shell-samples</module>
<module>spring-shell-shell1-adapter</module>
<module>spring-shell-starter</module>
</modules>
<dependencyManagement>
@@ -63,6 +64,11 @@
<artifactId>spring-shell-jcommander-adapter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-starter</artifactId>
<version>${project.version}</version>
</dependency>
<!-- OTHER DEPS -->
<dependency>
<groupId>org.jline</groupId>

View File

@@ -23,6 +23,7 @@
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.48</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -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

View File

@@ -27,27 +27,28 @@
</build>
<dependencies>
<!-- The following starter brings everything you need, including adapters that trigger only if needed-->
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-core</artifactId>
<artifactId>spring-shell-starter</artifactId>
</dependency>
<!-- Depend on Shell 1 to use Shell 1 API -->
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-standard</artifactId>
<artifactId>spring-shell</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
<!-- Depend on JCommander to use JCommander API -->
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-standard-commands</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-shell1-adapter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-jcommander-adapter</artifactId>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.48</version>
</dependency>
</dependencies>
</project>

View File

@@ -25,6 +25,7 @@
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell</artifactId>
<version>1.2.0.RELEASE</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -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}))

View File

@@ -0,0 +1,41 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-shell-starter</artifactId>
<name>Spring Shell Starter</name>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
</parent>
<description>Starter Dependency for Using Spring Shell</description>
<dependencies>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-standard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-standard-commands</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-shell1-adapter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-jcommander-adapter</artifactId>
</dependency>
</dependencies>
</project>