add version info
This commit is contained in:
@@ -46,5 +46,10 @@ dependencies {
|
||||
task wrapper(type: Wrapper) {
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes("version": "$version")
|
||||
}
|
||||
}
|
||||
|
||||
defaultTasks 'build'
|
||||
|
||||
@@ -1,39 +1,38 @@
|
||||
description = 'Hello World - Spring Shell'
|
||||
version = "$helloworldVersion"
|
||||
|
||||
description = 'Spring Shell Example'
|
||||
apply plugin: 'base'
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
// Public Spring artifacts
|
||||
mavenRepo name: "spring-release", urls: "http://repo.springsource.org/release"
|
||||
mavenRepo name: "spring-milestone", urls: "http://repo.springsource.org/milestone"
|
||||
mavenRepo name: "spring-snapshot", urls: "http://repo.springsource.org/snapshot"
|
||||
mavenCentral()
|
||||
maven { url "http://repo.springsource.org/snapshot" }
|
||||
maven { url "http://repo.springsource.org/release" }
|
||||
maven { url "http://repo.springsource.org/milestone" }
|
||||
maven { url "http://spring-roo-repository.springsource.org/release" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.springframework.shell:spring-shell:$springShellVersion"
|
||||
compile "org.springframework:spring-core:$springVersion"
|
||||
compile "org.springframework:spring-context-support:$springVersion"
|
||||
compile "org.springframework.shell:spring-shell:$springShellVersion"
|
||||
testCompile "junit:junit:$junitVersion"
|
||||
}
|
||||
|
||||
task copyDependency(type: Copy) {
|
||||
into "$buildDir/libs/dependency"
|
||||
from configurations.runtime
|
||||
}
|
||||
|
||||
project.ext.springShellJar = configurations.runtime.find { file -> file.name.contains("spring-shell")}
|
||||
//println("spring shell name is:" + project.ext.springShellJar.name)
|
||||
|
||||
project.ext.manifestClasspath = "dependency/" + springShellJar.name + " "
|
||||
project.ext.manifestClasspath = project.ext.manifestClasspath + configurations.runtime.collect{ File file -> "dependency/"+file.name}.join(' ')
|
||||
|
||||
jar {
|
||||
dependsOn configurations.runtime
|
||||
from {
|
||||
configurations.runtime.collect {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
}
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes("Main-Class": "org.springframework.shell.Bootstrap")
|
||||
}
|
||||
|
||||
baseName "helloworld"
|
||||
manifest {
|
||||
attributes 'Main-Class' : 'org.springframework.shell.Bootstrap', "Class-Path" : project.ext.manifestClasspath
|
||||
}
|
||||
}
|
||||
|
||||
defaultTasks 'build'
|
||||
|
||||
defaultTasks 'clean', 'build', 'copyDependency'
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
springVersion = 3.1.1.RELEASE
|
||||
springShellVersion=1.0.0.BUILD-SNAPSHOT
|
||||
springShellVersion = 1.0.0.BUILD-SNAPSHOT
|
||||
junitVersion = 4.8.1
|
||||
version = 1.0.0.BUILD-SNAPSHOT
|
||||
|
||||
|
||||
|
||||
helloworldVersion=1.0.0.BUILD-SNAPSHOT
|
||||
@@ -10,13 +10,13 @@ import org.springframework.stereotype.Component;
|
||||
public class HelloWorldCommands implements CommandMarker {
|
||||
|
||||
|
||||
@CliAvailabilityIndicator({"hw help"})
|
||||
@CliAvailabilityIndicator({"hw echo"})
|
||||
public boolean isCommandAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@CliCommand(value = "hw-echo", help = "Print a hello world message")
|
||||
public void config(
|
||||
@CliCommand(value = "hw echo", help = "Print a hello world message")
|
||||
public void hello(
|
||||
@CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final String message,
|
||||
@CliOption(key = { "name1"}, mandatory = true, help = "The hello world name1 ") final String name1,
|
||||
@CliOption(key = { "name2","name22" }, mandatory = true, help = "The hello world name2 ") final String name2,
|
||||
@@ -25,4 +25,26 @@ public class HelloWorldCommands implements CommandMarker {
|
||||
System.out.println("Hello world " + message + ", name1: " + name1 +
|
||||
", name2:" + name2 + ". time:" + time + ".location: " + location);
|
||||
}
|
||||
|
||||
@CliCommand(value = "hw auto", help = "Print a hello world message")
|
||||
public void autao(
|
||||
@CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final MessageType message){
|
||||
System.out.println("Hello world " + message);
|
||||
}
|
||||
|
||||
enum MessageType {
|
||||
Type1("type1"),
|
||||
Type2("type2"),
|
||||
Type3("type3");
|
||||
|
||||
private String type;
|
||||
|
||||
private MessageType(String type){
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType(){
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user